#include<stdio.h>

int main (void)
{
  long int n,m,a[1000001],i,sum=0;
  
  scanf("%ld %ld", &n,&m);
  
  for(i=0;i<m;i++){
    scanf("%ld", &a[i]);
    sum+=a[i];
  }
  
  if(sum <= n)
    printf("%ld", n-sum);
  else
    printf("-1");
  
  return 0;
}