#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define fast ios_base::sync_with_stdio(false)
#define cintie cin.tie(NULL)
int main()
{
	ll sum,x,d,n,i;
	cin>>d>>n;
	sum=0;
	for(i=0;i<n;i++)
	{
		cin>>x;
		sum=sum+x;
	}
	if(sum<=d)
	cout<<d-sum<<endl;
	else
	cout<<-1<<endl;
}
