#include <stdio.h>

int main(void)
{
    int a, b, c[50], i;

    scanf("%d %d", &a, &b);

    for (i = 0; i < b; ++i){
        scanf("%d", &c[i]);
        a -= c[i];
    }
    
    if (a < 0) printf("-1\n");

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

    return 0;

}