#include <bits/stdc++.h>
using namespace std;

int main() {
  int n,m,day=0;
  vector<int>  a(m);
  for (int i=0; i<m; i++) {
    cin >> a[i];
    day+=a[i];
  }
  if (n<day) cout << -1 << endl;
  else cout << n-day<< endl;
}
