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

    return 0;
}
