#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
	int n,m;cin>>n>>m;
	int a;bool chk=1;
	for(int i=0;i<m;i++){
		cin>>a;
		n-=a;
		if(n<0){
			chk=0;
			break;
		}
	}
	if(chk) cout<<n<<endl;
	else cout<<-1<<endl;
}
	