#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define vll vector<ll>

using namespace std;

const ll N = 3e5+100;
const ll MOD = 1e9+7;

int main()
{

	ll n,m;
	cin>>n>>m;
	ll a[n+1];
	ll sum = 0;
	for(int i =1;i<=m;i++){
		cin>>a[i];
		sum+=a[i];
	}
	if(sum>n){
		cout<<"-1\n";
	}
	else{
		cout<<n-sum<<endl;
	}
	
	return 0;
}