#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	ll n,r;
	cin>>n>>r;
	ll arr[r],sum=0;
	for(int i=0;i<r;i++){
		cin>>arr[i];
		sum += arr[i];
	}
	if(sum>n) cout<<"-1";
	else cout<<(n-sum);
	return 0;
}