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

int main() {
  int n,m;
  cin >> n >> m;
  vector<int> v(m);
  for (int i=0; i<m; i++) {
  	cin >> v[i];
  }
  int result = accumulate(v.begin(), v.end(), 0);
  if (result > n) {
    cout << -1 << endl;  	
  } else {
    cout << n - result << endl;
  }
}