#include<stdio.h>
int main()
{
    int N,M,i,sum;
    scanf("%d%d",&N,&M);
    int a[M];
    sum=0;
    for(i=0;i<M;i++){
        scanf("%d",&a[i]);
        sum+=a[i];
    }
    if(sum>N)
       printf("-1\n");
    else
        printf("%d\n",N-sum);
    return 0;
}
