#include <stdio.h>

int main(void){
    int n, m;
    scanf("%d%d", &n, &m);

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

    if(n < sum){
        printf("-1");
        return 0;
    }

    sum = n - sum;
    printf("%d", sum);
    return 0;

}