#include<stdio.h>

void main(){
    int hol;
    int num;
    int sum=0;

    scanf("%d",&hol);
    scanf("%d",&num);

    int s[sizeof(num)];

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

    if(hol < sum){
        printf("-1");
    }else{
        printf("%d",hol-sum);
    }

}