#include<stdio.h>

int main()
{
    int n, m, i, sum = 0, h;
    scanf("%d %d", &n, &m);
    int array[m];
    for(i = 0; i < m; i++){
        scanf("%d", &array[i]);
        sum = sum + array[i];
    }
    if(sum > n){
        printf("-1");
    }
    else{
        h = n - sum;
        printf("%d", h);
    }

    return 0;
}
