#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int mod=998244353;
#define mp make_pair
#define pb push_back
int main(){ 
	long long int t,n,b,c=0,d;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		cin>>b;
		c+=b;
		}
		if(n-c<0){
			cout<<-1<<endl;}
			else{
		cout<<n-c<<endl;
	}
    return 0;
}
