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

int main(void)
{
  int N, M;
  int total = 0;
  scanf("%d", &N);
  scanf("%d", &M);
  int A[M];
  for(int i = 0; i < M; i++){
    scanf("%d", &A[i]);
    total += A[i];
  }
  if(total > N){
    printf("-1\n");
  }
  else{
    printf("%d\n", N - total);
  }

  return 0;
  }
