#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, s = 0, k;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> k;
    s += k;
  }
  if (k > n)
    cout << -1 << endl;
  else
    cout << n - s << endl;
  return 0;
}
