#include <math.h>
#include <stdio.h>
#include <string.h>
int d, n, h[10001], ans = 0;
int main(void) {
    scanf("%d %d", &d, &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &h[i]);
    }
    for (int i = 0; i < n; i++) {
        ans = ans + h[i];
    }
    if (ans <= d) {
        printf("%d\n", d - ans);
    } else {
        printf("-1\n");
    }
}