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


return 0;
}
