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

int main(void) {
	
	int n, m, sum=0, ans;
	int a[100001];

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

	for (int i = 1; i <= m; i++)scanf("%d", &a[i]);

	for (int i = 1; i <= m; i++)sum += a[i];

	if (n < sum)printf("-1");
	else printf("%d", n - sum);

	return 0;
}