#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  ll n,m,s=0;
  cin>>n>>m;
  ll a[m+1],i;
  for(i=0;i<m;i++)
  {
      cin>>a[i];
      s+=a[i];
  }
  if(n-s<0)
    cout<<-1<<endl;
  else
    cout<<n-s<<endl;

}
