#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<long long> A(M);
  for (int i = 0; i < M; ++i) cin >> A[i];
  long long sum = accumulate(begin(A), end(A), 0LL);
  if (sum > N)
    cout << -1 << endl;
  else
    cout << N - sum << endl;
}
