#include <stdio.h>
#include <math.h>
int main(void) {
    long int a, b, n, m, i;
    long int sum = 0;
    scanf("%ld", &n);
    scanf("%ld\n", &m);
    for(i = 1; i <= m; i++) {
        scanf("%ld\n", &a);
        sum = sum + a;
    }
    b = n - sum;
    if(b < 0) {
        printf("-1\n");
    }
    else {
        printf("%ld\n", b);
    }
    return 0;
}