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

signed main(){
  lint N, M; cin >> N >> M;
  vector<lint> a(M);
  lint sum = 0;
  for(lint i = 0; i < M; i++){
    cin >> a[i]; sum += a[i];
  }
  if(sum > N) cout << -1 << endl;
  else cout << N - sum << endl;
}