#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long N, M;
  cin >> N >> M;
  int sum = 0;
  int a = 0;
  for (int i = 0; i < M; i++) {
    cin >> a;
    sum += a;
  }
  if (sum < N)
    cout << N - sum << endl;
  else if (sum == N)
    cout << 0 << endl;
  else
    cout << -1 << endl;
}
int main() {
  solve();
  return 0;
}
