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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll N,M;
	cin >> N>>M;
	ll sum = 0;
	for(int i =0; i<M;i++)
	{
		ll temp;
		cin >> temp;
		sum += temp;
	}
	if(sum > N)
	{
		cout <<"-1"<<endl;
	}
	else
	{
		cout << N-sum <<endl;
	}
	

}
