#include<stdio.h>
#include<math.h>
int main(){
  int unused __attribute__((unused));
  int i, N, M, A[10000];
  int sum = 0;

  unused = scanf("%d %d", &N, &M);
  for(i=0; i<M; i++){
    unused = scanf("%d", &A[i]);
    sum += A[i];
  }

  if(N-sum >= 0) printf("%d", N-sum);
  else printf("-1");
  return 0;
}