#include <stdio.h>

int main()
{
	int day, n, a;
	int sum = 0;

	scanf("%d %d", &day,&n);

	for (int i = 0; i < n; i++) {
		scanf("%d", &a);
		sum += a;
	}

	if (sum > day)
		sum = -1;
	else
		sum = day-sum;

	printf("%d\n", sum);

	return 0;
}