#include<bits/stdc++.h>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define pd(a,n) for(int i=0;i<n;i++)cout<<a[i]<<((i==n-1)?"\n":" ");cout<<endl;
#define pdd(a,n,m)for(int i=0;i<n;i++){for(int j=0;j<m;j++)cout<<a[i][j]<<" ";cout<<endl;}
#define mp make_pair
#define pb push_back
#define ll long long
//#define int ll
//#define __int64 lng long
#define P pair<int,int>
#define PP pair<P,int>

int n,m;
int a[111111];
int sum;

signed main(){
  cin>>n>>m;
  rep(i,m)cin>>a[i];
  rep(i,m)sum+=a[i];
  if(sum>n)
    cout<<-1<<endl;
  else
    cout<<n-sum<<endl;
  
  return 0;
}
