#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

int n,m,x,sum=0;

int main()
{
	cin>>n>>m;
	rep(i,m)
	{
		cin>>x;
		sum+=x;
	}
	if(sum>n) puts("-1");
	else cout<<n-sum<<endl;
	return 0;
}