#include <stdio.h>

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