#include<stdio.h>

int main(void){

    int day;
    int homework;
    int timeHomework[100001];


    //入力部分
    scanf("%d",&day);
    scanf("%d",&homework);

    for(int i=1;i<=homework;i++){
        scanf("%d",&timeHomework[i]);
    }

    //計算部分
    for(int i=1;i<=homework;i++){
        day -= timeHomework[i];
    }
    if(day < 0)day = -1;

    //出力部分
    printf("%d\n",day);
}