#include <stdio.h>


void main()
{
	int ans, N, M, A[10000],i,wa=0;
	scanf("%d %d", &N, &M);
	for (i = 0; i < M; i++)
	{
		scanf("%d", &A[i]);
		wa = wa + A[i];
	}
	if (wa <= N)
	{
		ans = N - wa;
	}
	else
	{
		ans = -1;
	}
	printf("%d", ans);
}
