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