#include <bits/stdc++.h>
using namespace std;

int main () {
  int N,M;
  cin >> N>>M;
  vector<int> A(M);
  for(int i = 0; i<M; i++) cin >> A[i];

  int wd = 0;
  for(int i = 0; i<M; i++) {
    wd += A[i];
  }
  if(N >= wd) cout << N - wd << endl;
  else cout << "-1" << endl;
}