#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define ll long long

int main(void)
{
    int n, m, a, i;
    scanf("%d%d", &n, &m);
    int count = 0;
    for (i = 0; i < m; i++)
    {
        scanf("%d", &a);
        count += a;
    }
    if (count > n)
    {
        printf("-1\n");
    }
    else
        printf("%d\n", n - count);
    return 0;
}