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

int main() {
  ll N,M;
  vector<ll> A(M);
  ll cost = 0;
  cin >> N >> M;
  for(ll i=0;i<M;i++){
    cin >> A.at(i);
  }
  
  for(ll i=0;i<M;i++){
    cost += A.at(i);
  }
  
  if(cost > N){
    cout << "-1" << endl;
  }else{
    cout << N - cost << endl;
  }
  
  return(0);
}