#include <stdio.h>

int main() {
    int n, m, a, i, soma=0, total;
    scanf("%d %d", &n, &m);
    for(i=0; m>i; ++i){
        scanf("%d", &a);
        soma = soma + a;
    }
    if(soma>n){
        printf("-1");
    }
    else{
    total = n - soma;
    printf("%d", total);
    }
    return 0;
}