#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>

#define M_PI 3.14159265358979323846

int main() {
	int n, m, i, total = 0;
	int a[1001];

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

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

	printf("%d\n", (n - total >= 0) ? (n - total) : (-1));

	return 0;
}
