#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long h, a;
  cin >> h >> a;
  long long sum = h, s = 0;
  vector<long long> V(a);
  for (long long i = 0; i < a; i++) {
    cin >> V[i];
    s += V[i];
  }
  sum -= s;
  if (sum > 0)
    cout << sum << endl;
  else if (sum == 0)
    cout << 0 << endl;
  else if (sum < 0)
    cout << -1 << endl;
  return 0;
}
