#include<stdio.h>
#include<math.h>
#define MOD 998244353
#define MAX 3001
#define MAX_DISTANCE 501
#define PRECISION 0.00000000001
#define INF 4000000000000000000
int main()
{
    int n,m,i;
    scanf("%d %d",&n,&m);
    int total=0;
    int inp;
    for(i=0;i<m;i++)
    {
        scanf("%d",&inp);
        total=total+inp;
    }
    if(total>n)
    {
        printf("-1");
    }
    else
    {
        printf("%d",n-total);
    }
    return 0;
}
