#include <stdio.h>
#include <stdlib.h>
#define _CRT_SECURE_NO_WARNINGS
int Question163B(void) {
	int insdate = 0;
	int inhome = 0;
	int inhdate[10001];
	(void)scanf("%d%d", &insdate, &inhome);
	for (int k = 0; k < inhome; k++) (void)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;
}