#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9+7;
//const ll mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const int ninf = 0xc0c0c0c0; 
int main(){
	//freopen("in.txt","r",stdin);
	int n,m;
	int a[10005];
	cin>>n>>m;
	int t;
	int sum=0;
	for(int i=0;i<m;i++){
		cin>>t;
		sum+=t;

	}
	if(sum>n) cout<<-1<<endl; else cout<<n-sum<<endl;
	return 0;
}