#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
int INF = 1 << 30;
long long INFL = 1LL << 60;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> h(M);
  for (long long i = 0; i < (M); i++) cin >> h.at(i);
  int sum = 0;
  for (long long i = 0; i < (M); i++) {
    sum += h[i];
  }
  if (sum <= N) {
    cout << N - sum << endl;
  } else {
    cout << -1 << endl;
  }
}
