#include<stdio.h>

int main()
{
	int n, m, a, i;
	int work = 0;
	scanf("%d%d", &n, &m);
	for (i = 0; i < m; i++) {
		scanf("%d", &a);
		work += a;
	}
	if (n < work)
		printf("%d", -1);
	else
		printf("%d", n - work);
}