#include<bits/stdc++.h>
#include<math.h>
using namespace std;

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