#include <bits/stdc++.h>
using namespace std;
#define fast_io {cin.sync_with_stdio(0); cout.sync_with_stdio(0);}
#define out(x,y) {cout<<x<<y;}
using ll = long long int;

int main(){
	fast_io;
	ll n,m;
	cin>>n>>m;
	ll ans = 0;
	for(ll i=0;i<m;i++){
		ll x; cin>>x; ans+=x;
	}
	if(ans<=n){
		cout<<n-ans<<endl;
	}
	else{
		cout<<-1<<endl;
	}
}