#include<bits/stdc++.h>
using namespace std;
//#define N 1000000
//int a[N];
main(){
	int n,m,a,all=0;
 	cin>>n>>m;
 	for(int i=0;i<m;i++)cin>>a,all+=a;
 	if(all>n)cout<<"-1\n";
 	else cout<<n-all<<"\n"; 
}