import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);
		int y = Integer.parseInt(str[1]);

		for (int i = 0; i <= n; i++) {
			for (int j = 0; j + i <= n; j++) {
				int k = (n - i - j);

				if (k < 0)
					continue;
				long sum = 10000 * i + 5000 * j + 1000 * k;

				//System.out.println(i + " " + j + " " + k);

				if (sum == y) {
					System.out.println(i + " " + j + " " + k);
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);
		int y = Integer.parseInt(str[1]);

		for (int i = 0; i <= n; i++) {
			for (int j = 0; j + i <= n; j++) {
				int k = (n - i - j);

				if (k < 0)
					continue;
				long sum = 10000 * i + 5000 * j + 1000 * k;

				//System.out.println(i + " " + j + " " + k);

				if (sum == y) {
					System.out.println(i + " " + j + " " + k);
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
	}
} Main public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);
		int y = Integer.parseInt(str[1]);

		for (int i = 0; i <= n; i++) {
			for (int j = 0; j + i <= n; j++) {
				int k = (n - i - j);

				if (k < 0)
					continue;
				long sum = 10000 * i + 5000 * j + 1000 * k;

				//System.out.println(i + " " + j + " " + k);

				if (sum == y) {
					System.out.println(i + " " + j + " " + k);
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);
		int y = Integer.parseInt(str[1]);

		for (int i = 0; i <= n; i++) {
			for (int j = 0; j + i <= n; j++) {
				int k = (n - i - j);

				if (k < 0)
					continue;
				long sum = 10000 * i + 5000 * j + 1000 * k;

				//System.out.println(i + " " + j + " " + k);

				if (sum == y) {
					System.out.println(i + " " + j + " " + k);
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str[] = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int n = Integer.parseInt(str[0]); n Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 int y = Integer.parseInt(str[1]); y Integer.parseInt(str[1]) Integer.parseInt Integer str[1] str 1 for (int i = 0; i <= n; i++) {
			for (int j = 0; j + i <= n; j++) {
				int k = (n - i - j);

				if (k < 0)
					continue;
				long sum = 10000 * i + 5000 * j + 1000 * k;

				//System.out.println(i + " " + j + " " + k);

				if (sum == y) {
					System.out.println(i + " " + j + " " + k);
					return;
				}
			}
		} int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
			for (int j = 0; j + i <= n; j++) {
				int k = (n - i - j);

				if (k < 0)
					continue;
				long sum = 10000 * i + 5000 * j + 1000 * k;

				//System.out.println(i + " " + j + " " + k);

				if (sum == y) {
					System.out.println(i + " " + j + " " + k);
					return;
				}
			}
		} {
			for (int j = 0; j + i <= n; j++) {
				int k = (n - i - j);

				if (k < 0)
					continue;
				long sum = 10000 * i + 5000 * j + 1000 * k;

				//System.out.println(i + " " + j + " " + k);

				if (sum == y) {
					System.out.println(i + " " + j + " " + k);
					return;
				}
			}
		} for (int j = 0; j + i <= n; j++) {
				int k = (n - i - j);

				if (k < 0)
					continue;
				long sum = 10000 * i + 5000 * j + 1000 * k;

				//System.out.println(i + " " + j + " " + k);

				if (sum == y) {
					System.out.println(i + " " + j + " " + k);
					return;
				}
			} int j = 0; int j = 0; j 0 j + i <= n j + i j i n j++ j++ j {
				int k = (n - i - j);

				if (k < 0)
					continue;
				long sum = 10000 * i + 5000 * j + 1000 * k;

				//System.out.println(i + " " + j + " " + k);

				if (sum == y) {
					System.out.println(i + " " + j + " " + k);
					return;
				}
			} {
				int k = (n - i - j);

				if (k < 0)
					continue;
				long sum = 10000 * i + 5000 * j + 1000 * k;

				//System.out.println(i + " " + j + " " + k);

				if (sum == y) {
					System.out.println(i + " " + j + " " + k);
					return;
				}
			} int k = (n - i - j); k (n - i - j) n - i - j n i j if (k < 0)
					continue; k < 0 k 0 continue; long sum = 10000 * i + 5000 * j + 1000 * k; sum 10000 * i + 5000 * j + 1000 * k 10000 * i + 5000 * j + 1000 * k 10000 * i 10000 i 5000 * j 5000 j 1000 * k 1000 k if (sum == y) {
					System.out.println(i + " " + j + " " + k);
					return;
				} sum == y sum y {
					System.out.println(i + " " + j + " " + k);
					return;
				} System.out.println(i + " " + j + " " + k) System.out.println System.out System System.out i + " " + j + " " + k " " j i + " " + j + " " + k i " " j " " k return; System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" String args[] args public class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);
		int y = Integer.parseInt(str[1]);

		for (int i = 0; i <= n; i++) {
			for (int j = 0; j + i <= n; j++) {
				int k = (n - i - j);

				if (k < 0)
					continue;
				long sum = 10000 * i + 5000 * j + 1000 * k;

				//System.out.println(i + " " + j + " " + k);

				if (sum == y) {
					System.out.println(i + " " + j + " " + k);
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
	}
} public class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);
		int y = Integer.parseInt(str[1]);

		for (int i = 0; i <= n; i++) {
			for (int j = 0; j + i <= n; j++) {
				int k = (n - i - j);

				if (k < 0)
					continue;
				long sum = 10000 * i + 5000 * j + 1000 * k;

				//System.out.println(i + " " + j + " " + k);

				if (sum == y) {
					System.out.println(i + " " + j + " " + k);
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);
		int y = Integer.parseInt(str[1]);

		for (int i = 0; i <= n; i++) {
			for (int j = 0; j + i <= n; j++) {
				int k = (n - i - j);

				if (k < 0)
					continue;
				long sum = 10000 * i + 5000 * j + 1000 * k;

				//System.out.println(i + " " + j + " " + k);

				if (sum == y) {
					System.out.println(i + " " + j + " " + k);
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
	}
}
