#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t;
  cin >> n >> t;
  int sum = 0;
  while (t--) {
    int a;
    cin >> a;
    sum += a;
  }
  if (sum > n) {
    cout << -1 << endl;
  } else {
    cout << n - sum << endl;
  }
  return 0;
}
