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