#include <stdio.h>
int Question163B(void) {
	int insdate;
	int inhome;
	int inhdate[10001];
	int output ;

	scanf("%d %d", &insdate, &inhome);
	for (int k = 0; k < inhome; k++) scanf("%d", &inhdate[k]);

	int num = 0;
	for (int i = 0; i < inhome; i++) num = num + inhdate[i];

	if (num > insdate) printf("%d\n", -1);
	else printf("%d\n", insdate - num);

	return 0;
}
