#include <stdio.h>
#include <string.h>
#include <stdbool.h>

int main() {
    int n, m;
    scanf("%d %d", &m, &n);
    int sum = 0;
    while (n--) {
        int tt; scanf("%d", &tt);
        sum += tt;
    }
    if (sum > m) printf("-1\n");
    else printf("%d\n", m - sum);
}