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

    return 0;

}
