#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  int n, m;
  cin >> n >> m;
  vi a(m);
  for (int((i)) = (int)(0); ((i)) < (int)((m)); ++((i))) cin >> a[i];
  int sum = 0;
  for (int((i)) = (int)(0); ((i)) < (int)((m)); ++((i))) sum += a[i];
  if (n >= sum)
    cout << n - sum << endl;
  else
    cout << -1 << endl;
  return 0;
}
