#include<stdio.h>

int main(void) {
	int n, m;
	int a[100];

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

	for (int i = 0; i < m; i++) {
		scanf_s("%d", &a[i]);
	}

	for (int i = 0; i < m; i++) {
		n -= a[i];
		if (n < 0) {
			printf("-1\n");
			return 0;
		}
	}

	printf("%d\n", n);

	return 0;
}