#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void) {
  long long int n, m;
  scanf("%lld %lld", &n, &m);
  for (long long int i = 0; i < m; i++) {
    long long int a;
    scanf(" %lld", &a);
    n -= a;
    if (n < 0) {
      printf("-1\n");
      return 0;
    }
  }
  printf("%lld\n", n);

  return 0;
}
