#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll int64_t
#define all(v) v.begin(), v.end()
#define bitrep(n) for(int bit=0;bit<(1<<n);bit++)


int main() {

  int N,M; cin >> N >> M ;

  vector<int> A(M);

  rep(i,M) cin >> A[i];

  ll sum=0;

  rep(i,M) sum+=A[i];

  ll ans=N-sum;

  if(ans<0) cout << -1 << endl;

  else cout << ans << endl;

  return 0;
}