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

int main(){
  ll N, M;
  cin >> N >> M;

  ll sum = 0;
  for(ll i=0; i<M; i++){
    ll tmp;
    cin >> tmp;
    sum += tmp;
  }
  if(sum <= N){
    cout << N - sum << endl;
  }else{
    cout << -1 << endl;
  }
}