#include <stdio.h>

int main(void){

  long n,m;
  scanf("%ld %ld", &n, &m);
  long a[m];
  for (long i = 0; i < m; i++) {
    scanf("%ld", &a[i]);
  }
  long sum = 0;
  for (long i = 0; i < m; i++) {
    sum += a[i];
  }
  if (sum > n) {
    printf("-1\n");
  } else {
    printf("%ld\n", n-sum);
  }

  return 0;
}