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

    

    return 0;
}