#include<stdio.h>

int main()
{
    int N,M,Ai,sum;
    scanf("%d%d",&N,&M);
    sum = 0;
    for(int i=0; i<M; i++)
    {
        scanf("%d",&Ai);
        sum = sum + Ai;
    }
    if(N<sum)
        printf("-1\n");
    else
        printf("%d\n",N - sum);


}
