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