import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	int N, Y;
	int x = -1, y = -1, z = -1;

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		N = Integer.parseInt(tokens[0]);
		Y = Integer.parseInt(tokens[1]);
	}

	void calc() {
		for (int i = 0; i * 10000 <= Y; ++i) {
			int remain0 = Y - i * 10000;
			for (int j = 0; j * 5000 <= remain0; ++j) {
				int remain1 = remain0 - j * 5000;
				if (remain1 / 1000 + i + j == N) {
					x = i;
					y = j;
					z = remain1 / 1000;
					return;
				}
			}
		}
	}

	void showResult() {
		System.out.println(x + " " + y + " " + z);
	}
} import java.util.*; util.* java import java.io.*; io.* java import java.nio.charset.StandardCharsets; StandardCharsets java.nio.charset public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	int N, Y;
	int x = -1, y = -1, z = -1;

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		N = Integer.parseInt(tokens[0]);
		Y = Integer.parseInt(tokens[1]);
	}

	void calc() {
		for (int i = 0; i * 10000 <= Y; ++i) {
			int remain0 = Y - i * 10000;
			for (int j = 0; j * 5000 <= remain0; ++j) {
				int remain1 = remain0 - j * 5000;
				if (remain1 / 1000 + i + j == N) {
					x = i;
					y = j;
					z = remain1 / 1000;
					return;
				}
			}
		}
	}

	void showResult() {
		System.out.println(x + " " + y + " " + z);
	}
} Main int N N Y; Y int x = -1 x -1 1 y = -1 y -1 1 z = -1; z -1 1 public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	} main {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	} InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8); reader new InputStreamReader(System.in, StandardCharsets.UTF_8) BufferedReader in = new BufferedReader(reader); in new BufferedReader(reader) Main ins = new Main(in); ins new Main(in) ins.calc() ins.calc ins ins.showResult() ins.showResult ins String[] args args Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		N = Integer.parseInt(tokens[0]);
		Y = Integer.parseInt(tokens[1]);
	} Main {
		String[] tokens = in.readLine().split(" ");
		N = Integer.parseInt(tokens[0]);
		Y = Integer.parseInt(tokens[1]);
	} String[] tokens = in.readLine().split(" "); tokens in.readLine().split(" ") in.readLine().split in.readLine() in.readLine in " " N = Integer.parseInt(tokens[0]) N Integer.parseInt(tokens[0]) Integer.parseInt Integer tokens[0] tokens 0 Y = Integer.parseInt(tokens[1]) Y Integer.parseInt(tokens[1]) Integer.parseInt Integer tokens[1] tokens 1 BufferedReader in in void calc() {
		for (int i = 0; i * 10000 <= Y; ++i) {
			int remain0 = Y - i * 10000;
			for (int j = 0; j * 5000 <= remain0; ++j) {
				int remain1 = remain0 - j * 5000;
				if (remain1 / 1000 + i + j == N) {
					x = i;
					y = j;
					z = remain1 / 1000;
					return;
				}
			}
		}
	} calc {
		for (int i = 0; i * 10000 <= Y; ++i) {
			int remain0 = Y - i * 10000;
			for (int j = 0; j * 5000 <= remain0; ++j) {
				int remain1 = remain0 - j * 5000;
				if (remain1 / 1000 + i + j == N) {
					x = i;
					y = j;
					z = remain1 / 1000;
					return;
				}
			}
		}
	} for (int i = 0; i * 10000 <= Y; ++i) {
			int remain0 = Y - i * 10000;
			for (int j = 0; j * 5000 <= remain0; ++j) {
				int remain1 = remain0 - j * 5000;
				if (remain1 / 1000 + i + j == N) {
					x = i;
					y = j;
					z = remain1 / 1000;
					return;
				}
			}
		} int i = 0; int i = 0; i 0 i * 10000 <= Y i * 10000 i 10000 Y ++i ++i i {
			int remain0 = Y - i * 10000;
			for (int j = 0; j * 5000 <= remain0; ++j) {
				int remain1 = remain0 - j * 5000;
				if (remain1 / 1000 + i + j == N) {
					x = i;
					y = j;
					z = remain1 / 1000;
					return;
				}
			}
		} {
			int remain0 = Y - i * 10000;
			for (int j = 0; j * 5000 <= remain0; ++j) {
				int remain1 = remain0 - j * 5000;
				if (remain1 / 1000 + i + j == N) {
					x = i;
					y = j;
					z = remain1 / 1000;
					return;
				}
			}
		} int remain0 = Y - i * 10000; remain0 Y - i * 10000 Y i * 10000 i 10000 for (int j = 0; j * 5000 <= remain0; ++j) {
				int remain1 = remain0 - j * 5000;
				if (remain1 / 1000 + i + j == N) {
					x = i;
					y = j;
					z = remain1 / 1000;
					return;
				}
			} int j = 0; int j = 0; j 0 j * 5000 <= remain0 j * 5000 j 5000 remain0 ++j ++j j {
				int remain1 = remain0 - j * 5000;
				if (remain1 / 1000 + i + j == N) {
					x = i;
					y = j;
					z = remain1 / 1000;
					return;
				}
			} {
				int remain1 = remain0 - j * 5000;
				if (remain1 / 1000 + i + j == N) {
					x = i;
					y = j;
					z = remain1 / 1000;
					return;
				}
			} int remain1 = remain0 - j * 5000; remain1 remain0 - j * 5000 remain0 j * 5000 j 5000 if (remain1 / 1000 + i + j == N) {
					x = i;
					y = j;
					z = remain1 / 1000;
					return;
				} remain1 / 1000 + i + j == N remain1 / 1000 + i + j remain1 / 1000 + i + j remain1 / 1000 remain1 1000 i j N {
					x = i;
					y = j;
					z = remain1 / 1000;
					return;
				} x = i x i y = j y j z = remain1 / 1000 z remain1 / 1000 remain1 1000 return; void showResult() {
		System.out.println(x + " " + y + " " + z);
	} showResult {
		System.out.println(x + " " + y + " " + z);
	} System.out.println(x + " " + y + " " + z) System.out.println System.out System System.out x + " " + y + " " + z " " y x + " " + y + " " + z x " " y " " z public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	int N, Y;
	int x = -1, y = -1, z = -1;

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		N = Integer.parseInt(tokens[0]);
		Y = Integer.parseInt(tokens[1]);
	}

	void calc() {
		for (int i = 0; i * 10000 <= Y; ++i) {
			int remain0 = Y - i * 10000;
			for (int j = 0; j * 5000 <= remain0; ++j) {
				int remain1 = remain0 - j * 5000;
				if (remain1 / 1000 + i + j == N) {
					x = i;
					y = j;
					z = remain1 / 1000;
					return;
				}
			}
		}
	}

	void showResult() {
		System.out.println(x + " " + y + " " + z);
	}
} public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	int N, Y;
	int x = -1, y = -1, z = -1;

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		N = Integer.parseInt(tokens[0]);
		Y = Integer.parseInt(tokens[1]);
	}

	void calc() {
		for (int i = 0; i * 10000 <= Y; ++i) {
			int remain0 = Y - i * 10000;
			for (int j = 0; j * 5000 <= remain0; ++j) {
				int remain1 = remain0 - j * 5000;
				if (remain1 / 1000 + i + j == N) {
					x = i;
					y = j;
					z = remain1 / 1000;
					return;
				}
			}
		}
	}

	void showResult() {
		System.out.println(x + " " + y + " " + z);
	}
} Main
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	int N, Y;
	int x = -1, y = -1, z = -1;

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		N = Integer.parseInt(tokens[0]);
		Y = Integer.parseInt(tokens[1]);
	}

	void calc() {
		for (int i = 0; i * 10000 <= Y; ++i) {
			int remain0 = Y - i * 10000;
			for (int j = 0; j * 5000 <= remain0; ++j) {
				int remain1 = remain0 - j * 5000;
				if (remain1 / 1000 + i + j == N) {
					x = i;
					y = j;
					z = remain1 / 1000;
					return;
				}
			}
		}
	}

	void showResult() {
		System.out.println(x + " " + y + " " + z);
	}
}