#include <stdio.h>
#include <math.h>

int main (void)
{
    unsigned long n, m, sum=0;
    long ans;
    unsigned long a[10000];
    int i;

    scanf("%lu %lu", &n, &m);

    for (i = 0; i < m; i++) {
        scanf("%lu", &(a[i]));
        sum += a[i];
    }

    ans = n - sum;

    if (ans >= 0) {
        printf("%ld", ans);
    } else {
        puts("-1");
    }

    return 0;
}

