#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using v = vector<int>;
int main() {
  int N, M;
  ll sum = 0;
  cin >> N >> M;
  for (int i = 0; i < (M); i++) {
    int A;
    cin >> A;
    sum += A;
  }
  if (sum > N)
    cout << -1 << endl;
  else
    cout << N - sum << endl;
}
