#include <stdio.h>

int main()
{
	long N;
	scanf("%ld", &N);
	long M;
	scanf("%ld", &M);
	long a[M + 1];
	int i = 0;
	long sum = 0;
	while (i < M)
	{
		scanf("%ld", &a[i]);
		sum += a[i];
		i++;
	}
	if (N - sum >= 0)
		printf("%ld\n", N - sum);
	else
	{
			printf("-1\n");
	}
	
	return 0;
}
