#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std; 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  ll n,m;
  cin>>n>>m;
  ll a[m];
  ll sum=0;
  for(ll i=0;i<m;i++)
  {
      cin>>a[i];
      sum+=a[i];
  }
  if(sum>n)
  cout<<-1<<endl;
  else
  cout<<n-sum<<endl;
  return 0;
}