#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, y, x, z, h, t, i, j, k;
  long long cnt = 0, cnt1 = 0, sum = 0, sum1 = 0, flag = 0, flag1 = 0,
            maxi = LLONG_MIN, mini = LLONG_MAX, temp = 0, ans = 0;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> t;
  cin >> n;
  while (n) {
    cin >> cnt;
    sum += cnt;
    n--;
  }
  if (sum < t) {
    cout << t - sum << endl;
  } else {
    cout << -1 << endl;
  }
  return 0;
}
