#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fi first
#define se second
ll sieve[1000001]={0},i,j;
ll m=1e9+7;
ll lev=0;
ll n,k;
ll power(ll p, ll k)
{
ll a=1;
while(k)
{
if(k&1)
a=(a*p)%m;
p=(p*p)%m;
k>>=1;
}
return a;
}
using namespace std;
vector<ll> v[1000000+1];
ll vis[1000000+1]={0};
void dfs(ll u,ll p,ll lev)
{
    vis[u]=lev;
for(auto x: v[u])
{
if(x!=p)
{
dfs(x,u,lev+1);
}
}
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 int tc=1;
//cin>>tc;
ll cas=1;
 while(tc--)
 {
  
 ll n,m;
 cin>>n>>m;
 ll a[m];
 ll ans=n;
 for(i=0;i<m;i++)
 {
 cin>>a[i];
 ans-=a[i];
  }
  if(ans>=0)
  cout<<ans;
  else
  cout<<-1;
     cout<<"\n"; 
 } 
}
