#include<stdio.h>
int main(){
    int n, m;
    scanf("%d %d", &n, &m);
    int a, total=0;
    for (int i=0; i<m; ++i){
        scanf("%d", &a);
        total+=a;
    }
    if (total>n){
        printf("-1\n");
    }else{
        printf("%d\n", n-total);
    }
    return 0;
}
