#include <stdio.h>

int main(void)
{
  int i, N, M;
  do{
    scanf("%d", &N);
  }while(1<=N && N<=1000000);
  
  do{
    scanf("%d", &M);
  }while(1<=N && N<=10000);
  
  int A[M];
  int L = 0;
  for(i=1; i<=M; i++){
    scanf("%d", &A[M]);
    L = L + A[M];
  }
  if(L > N)
    return -1;
  else
    retutn 0;
}
   