#include<stdio.h>

int main(void){

    int N,M;
    int i;
    int A;
    int total=0;

    scanf("%d %d\n", &N, &M);

    for( i = 1; i <= M; i++ ){
        scanf("%d", &A);
        total += A;
    }

    if( N >= total ){
        printf("%d\n", N-total);
    }
    else{
        printf("-1\n");
    }

    return 0;
}
