#include <stdio.h>

int main() 
{

    int hwnum, day;
    int hw;
    int sumday = 0;

    scanf("%d %d", &day, &hwnum);

    for (int i = 0; i < hwnum; ++i){
        scanf("%d", &hw);
        sumday += hw;
    }

    if ( sumday > day ){
        printf("%d",-1);

    }  else {
        printf("%d", day - sumday);
    }
    
    return 0;

}

