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