#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

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