#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define mod 998244353
#define MAX 100009
#define endl '\n'
#define mp make_pair
#define INF 1000000000
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

using namespace std;

int main() {
	fast
	ll n,m;
	cin>>n>>m;
	ll a[m];
	forn(i,m)	cin>>a[i];
	ll sum=0;
	forn(i,m)	sum+=a[i];
	if(sum>n)	cout<<-1;
	else	cout<<n-sum;
}
//cout<<"Case #"<<x<<": "<<ans<<endl;
//x++;