#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
 
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  /* freopen("input.txt","r",stdin);
     freopen("output.txt","w",stdout);
  */ 
  ll n,m;
  cin>>n>>m;
  ll arr[m],i,sum=0;
  for(i=0;i<m;i++)
  {
     cin>>arr[i];
  }
  for(i=0;i<m;i++)
  {
     sum=sum+arr[i];
  }
  if(sum>n)
  {
     cout<<"-1\n";
  }
  else
  {
     cout<<n-sum<<'\n';
  }
   
   
  return 0;
}