#include <stdio.h>

int main() {
    int dia, n;
    scanf("%d %d", &dia, &n);
    
    int vec[n], total = 0;
    
    for (int i = 0; i < n; ++i){
        scanf("%d", &vec[i]);
        total += vec[i];
    }
    if (dia - total >= 0)
        printf("%d\n", dia - total);
    else
        printf("-1\n");
    return 0;
}
