#include<bits/stdc++.h>
using namespace std;
int main()
{
  long N, M, x;
  cin>>N>>M;
  for (long i = 0; i < M; i++)
  {
    cin>>x;
    N -= x;
  }
  if (N < 0)
    cout<<-1;
  else cout<<N;
  return 0;
}