#include <stdio.h>
int main()
{
  int N;
  int M;
  int A[10000];
  int index;
  int total = 0;
  
  scanf("%d %d", &N, &M);
  for(index = 0; index < M; ++index){
    scanf("%d", &A[index]);
    total += A[index];
  }
  
  if(total > N)
    printf("-1\n");
  else
    printf("%d\n", (N - total));
  return 0;
}