#include<stdio.h>

int Question163B(void) {
	int insdate, inhome, inhdate[10001], num = 0;
	scanf("%d%d", &insdate, &inhome);
	for (int k = 0; k < inhome; k++) {
		scanf("%d", &inhdate[k]);
		num = num + inhdate[k];
	}
	if (num > insdate) printf("%d\n", -1);
	else printf("%d\n", insdate - num);
	return 0;
}