#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, m;
  cin >> n >> m;
  long long int sm = 0, x;
  for (long long int i = 0; i < m; i++) cin >> x, sm += x;
  n -= sm;
  if (n < 0)
    cout << -1;
  else
    cout << n;
}
int main() {
  long long int t = 1;
  while (t--) {
    solve();
    cout << endl;
  }
  return 0;
}
