#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
vector <int> v;
int n,a,i,c=0,l,as=0;
cin>>n>>a;
for(i=0;i<a;i++)
{
	cin>>l;
	v.push_back(l);
	c+=v[i];
}
if(c<=n)
{
  as=n-c;
  cout<<as;	
}else
{
	cout<<"-1";
}

}
