#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, d, sum = 0, x;
  cin >> n >> d;
  for (long long i = 0; i < d; i++) {
    cin >> x;
    sum += x;
  }
  if (n < sum)
    cout << -1;
  else
    cout << n - sum;
}
