#include <stdio.h>
#include <math.h>

int main(void){

    int days, number, i, sum, ans;
    int syukudai[100000] = {0};

    scanf("%d", &days);
    scanf("%d", &number);

    sum = 0;

    for(i = 0; i < number; i++){
        scanf("%d", &syukudai[i]);
        sum += syukudai[i];
    }

    ans = days - sum;

    if(ans < 0){
        printf("-1\n");
    }

    else printf("%d\n", ans);

    return 0;

}