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

int main(void){
    int n,m,amount,sum = 0;
    scanf("%d%d",&n,&m);
    for(int i = 0;i<m;i++){
        scanf("%d",&amount);
        sum += amount;
    }
    if(n < sum) printf("%d",-1);
    else printf("%d",n - sum);
    return 0;
}