#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(M);
  for (int i=0; i<M; i++) cin >> A[i];
  ll sum = accumulate(A.begin(), A.end(), 0LL);
  if (N<sum) cout << -1 << endl;
  else cout << N-sum << endl;
}