//#include <GOD>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define len length
ll n,m,x,sum;
int main(){
	cin>>n>>m;
	for(int i=0;i<m;i++){
		cin>>x;
		sum+=x;
	}
	if(sum>n){
		cout<<-1<<endl;
	}else{
		cout<<n-sum<<endl;
	}
}
