#include <stdio.h>

int main(void) {
    int N, M;
    scanf("%d %d", &N, &M);
    int A = 0;
    for (int i = 0; i < M; i++) {
        int a = 0;
        scanf("%d", &a);
        A += a;
    }

    if (N < A) {
        printf("-1\n");
        return 0;
    }
    
    printf("%d\n", N - A);


    return 0;
}