#include <stdio.h>

int main(){
    int N, M;
    int A[10000];
    int sum = 0;
    int play = 0;

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

    if(sum > N){
        printf("-1");
    }else{
        play = N - sum;
        printf("%d", play);
    }
    }