#include<stdio.h>
int main()
{
	int n, m;
	scanf("%d %d", &n, &m);
	int i;
	int a[10004];
	for (i = 0; i < m; i++)
		scanf("%d", &a[i]);
	int sum = 0;
	for (i = 0; i < m; i++)
		sum += a[i];
	if (n < sum)
		printf("-1\n");
	else
		printf("%d\n", n - sum);
	return 0;
}