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