#include <stdio.h>

int main()
{
    int n, m, i, tmp;
    int sum = 0;

    scanf("%d%d", &n, &m);
    
    for (i = 0; i < m; i++) {
        scanf("%d", &tmp);
        sum += tmp;
    }

    if (sum <= n)
        printf("%d\n", n-sum);
    else
        printf("%d\n", -1);

    return 0;
}