#include <stdio.h>

int main()
{
  int n,m;
  scanf("%d%d",&n,&m);
  int a[m];
  int i;
  i = 0;
  int sum;
  sum = 0;
  while (i < m)
  {
    scanf("%d",&a[i]);
    sum += a[i];
    i++;
  }
  if (sum <= n)
    printf("%d",n-sum);
  else
    printf("%d",-1);
  
}