#include <stdio.h>

int main(void){

    long n, m, res = 0, e;
    int i, j;

    scanf("%ld %d\n", &n,&i);
    
    for(j=0; j<i; j++){
        scanf(" %ld", &m);
        res += m;
    }

    e = n - res;
    if(e< 0){
        printf("-1\n");
    }else{
        printf("%ld\n", e);
    }

    return 0;
}