read N Y

z0=$(( (Y % 5000) / 1000 ))

for (( z = z0; z <= N; z += 5 )); do
    Z=$(( Y - z * 1000 - 5000 * (N - z) ))
    x=$(( Z / 5000 ))
    y=$(( N - x - z ))
    (( x >= 0 && y >= 0 )) && echo ${x} ${y} ${z} && exit
done

echo -1 -1 -1
