#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;
  cin >> n >> m;
  long long arr[10010];
  long long count = 0;
  for (long long i = 0; i < m; i++) {
    cin >> arr[i];
  }
  for (long long i = 0; i < m; i++) {
    count = count + arr[i];
  }
  if (count < n) {
    cout << "-1" << endl;
  } else {
    cout << n - count << endl;
  }
  return 0;
}
