#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int main(void) {
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  ll tmp = 0;
  for (int i = (0); i < (m); ++i) {
    cin >> a[i];
    tmp += a[i];
  }
  if (tmp > n)
    cout << -1 << endl;
  else
    cout << n - tmp << endl;
  return 0;
}
