#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX(a, b) ((a) > (b) ? (a) : (b))


int main(void)
{
long N, M, index;
long A[10000];

  scanf("%ld %ld", &N, &M);
  for (index = 0; index < M; ++index) {
    scanf("%ld", &A[index]);
    N -= A[index];
  }
  if (N < 0) {
    printf("-1\n");
  } else {
    printf("%ld\n", N);
  }
  
  return 0;
}
