#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
double PI = 3.1415;
int N, M;
void calc() {
  cin >> N >> M;
  vector<int> A(M);
  for (int i = 0; i < (int)(M); ++i) cin >> A[i];
  long long sum = accumulate(A.begin(), A.end(), 0);
  if (N < sum)
    cout << "-1\n";
  else
    cout << N - sum << endl;
  return;
}
int main() { calc(); }
