import std.stdio, std.conv, std.string;
import std.algorithm, std.array, std.container;
import std.numeric, std.math;
import core.bitop;

T RD(T = string)() { static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }

long mod = pow(10, 9) + 7;
long moda(long x, long y) { return (x + y) % mod; }
long mods(long x, long y) { return ((x + mod) - (y % mod)) % mod; }
long modm(long x, long y) { return (x * y) % mod; }

void main()
{
	auto N = RD!long;
	auto Y = RD!long;
	long r1 = (Y % 5000) / 1000;
	long r5 = (Y % 10000) / 5000;
	long r10 = Y / 10000;

	while (r1 + r5 + r10 < N)
	{
		if (r1 + r5 + r10 + 4 <= N && r5 > 0)
		{
			--r5;
			r1 += 5;
		}
		else if (r10 > 0)
		{
			--r10;
			r5 += 2;
		}
		else break;
	}
	if (r1 + r5 + r10 != N)
	{
		writeln("-1 -1 -1");
	}
	else
	{
		writeln(r10, " ", r5, " ", r1);
	}

	stdout.flush();
}