#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define puts(i) cout<<i<<endl
#define div 1e9+7
#define pi 3.14159265358979
using ll = long long;
using P = pair<int,int>;
int main(){
	int n,m;
	cin>>n>>m;
	int a[m];
	int sum=0;
	rep(i,m){
		cin>>a[i];
		sum+=a[i];
	}
	if(sum>n)
		puts(-1);
	else
		puts(n-sum);
	
}
