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