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

int main() {
  int n , m;
  cin >> n >> m;
  
  ll count =0;
  vector<int>a(m);
  for(int i=0; i<m; i++){
    cin >> a[i];
    count+=a[i];
  }
  
  ll ans = n-count;
  
  if(ans<0) cout << -1 << endl;
  else cout << ans << endl;
    
  
  

}