#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m;
  cin >> n >> m;
  long long sum = 0;
  for (long long i = 0; i < m; i++) {
    long long x;
    cin >> x;
    sum += x;
  }
  if (sum <= n)
    cout << n - sum << endl;
  else
    cout << "-1" << endl;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
