#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll maxn=2e5+1;
void solve()
{
	ll N,M;
	cin>>N>>M;
	ll a[maxn],sum=0;
	for(ll i=0;i<M;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	if(sum>N) cout<<-1<<"\n";
	else cout<<N-sum<<"\n";
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll T=1,p=0;
	//cin>>T;
	do
	{
		solve();
		p++;
	}while(p<T);
	return 0;
}

