#include <stdio.h>
#include <stdlib.h>

int main()
{
  int N, M;
  int *A;
  int Re, sum=0;
  A=(int*)malloc(sizeof(int)*M);
  
  scanf("%d %d", &N, &M);
  for (int i=0;i<M;i++)
    scanf(" %d", &A[i]);
  for (int i=0;i<M;i++)
    sum +=A[i];
  Re = N - sum;
  if (Re >= 0)
  	printf("%d\n", Re);
  else
    printf("%d\n", -1);
  fflush(stdout);
  free(A);
  return 0;
}