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