#include <stdio.h>

int Question163B(void) {
	int insdate = 0;
	int inhome = 0;
	int inhdate[10001] = { 0 };
	int output = 0;

	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;
}