
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
   ll n,m,ans=0;
   cin>>n>>m;
   ll a[m];
   for(int i=0;i<m;i++){
       cin>>a[i];
       ans+=a[i];
   }
   if(n<ans)
       cout<<"-1";
   else
       cout<<n-ans;
}

