#include <bits/stdc++.h>
using namespace std;
bool compare(long long a, long long b) { return a > b; };
int32_t main() {
  long long n, m;
  scanf("%d%d", &n, &m);
  long long arr[m];
  for (long long i = 0; i < m; i++) {
    scanf("%d", &arr[i]);
  }
  long long count = 0;
  for (long long i = 0; i < m; i++) {
    count = count + arr[i];
  }
  if (count > n) {
    printf("-1\n");
  } else {
    printf("%d\n", n - count);
  }
  return 0;
}
