#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int all = 0;
  vector<int> a(m);
  for (int i = 0; i < m; i++) {
    cin >> a.at(i);
    all += a.at(i);
  }
  if (n - all >= 0) {
    cout << n - all << endl;
  } else {
    cout << -1 << endl;
  }
}
