#include <stdio.h>

int main()
{
    int N, M, A[10000], i, v = 0, s = 0;
    scanf("%d",&N);
    scanf("%d",&M);
    for(i=1; i<=M; i++){
        scanf("%d",&A[i]);
        s = s + A[i];
    }
    if(s > N){
        v = -1;
    }
    else{
     v = N - s;   
    }
    
    printf("%d",v);
    return v;
}