#include <stdio.h>

int		main(void)
{
	int N;
	int M;
	int i = 0;
	int A[10000];
	int sum = 0;

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