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

int main(){
	int i;
	long N, M;
	long *A;

	scanf("%ld %ld", &N, &M);
	A = malloc(M * sizeof(long));

	for(i=0; i<M; i++){
		scanf("%ld", &A[i]);
	}

	for(i=0; i<M; i++){
		N -= A[i];
	}

	if(N<0) printf("-1");
	else printf("%ld", N);

	return 0;
}
