/*#include<bits/stdc++.h>
using namespace std;
const long double PI=3.14159265358979323846;

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int r; cin>>r;
	cout<<fixed<<setprecision(20)<<2*r*PI<<"\n"s;
}*/

#include<bits/stdc++.h>
using namespace std;

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int64_t n,m; cin>>n>>m;
	int64_t sum=0;
	for(int i=0;i<m;++i){
		int64_t a; cin>>a;
		sum+=a;
	}
	cout<<(n-sum<0?-1:n-sum)<<"\n"s;
}