#include <stdio.h>
#include <math.h>

int main()
{
	unsigned int n,m,a,sum,cnt;
	int ret;

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

	if (n < 1 || n > 1000000 ||
	    m < 1 || m > 10000) {
			return 1;
	}

	cnt = m;
	sum = 0;
	do {
		a = 0;
		scanf("%d", &a);
		if (a < 1 || a > 10000) {
			continue;
		}
		sum+=a;
		cnt--;
		// printf("a = %d\n", a);
	} while (cnt);

	ret = n - sum;

	if (ret < 0) {
		printf("-1");
	} else {
		printf("%d", ret);
	}
	
	return 0;
}
