#include <stdio.h>
#include <stdlib.h>

int main(){
	char buf[30];
	char *p;
	int n, m;
	int sum_a = 0;

	p = buf;
	scanf("%d %d\n", &n, &m);
	while (0<m){
		int day = 0;
		char c = getchar();
		while((c!=' ') && (c!=10)){
			day *= 10;
			day += c - '0';
			c = getchar();
		}
		sum_a += day;
		m--;
		if (n<sum_a){
			printf("%d", -1);
			return (0);
		}
	}
	printf("%d", n - sum_a);
	return (0);
}
