import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int y = sc.nextInt();
		int osatu[] = { 10000, 5000, 1000 };
		int ans[] = { -1, -1, -1 };
		for (int i = 0; i <= n; i++) {
			if (y - i * osatu[0] > 5000 * (n - i)) {
			} else {
				for (int j = 0; j + i <= n; j++) {
					if (y - i * osatu[0] - j * osatu[1] - (n - i - j) * osatu[2] == 0) {
						ans[0] = i;
						ans[1] = j;
						ans[2] = n - i - j;
					}
				}
			}
		}
		System.out.println(ans[0] + " " + ans[1] + " " + ans[2]);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int y = sc.nextInt();
		int osatu[] = { 10000, 5000, 1000 };
		int ans[] = { -1, -1, -1 };
		for (int i = 0; i <= n; i++) {
			if (y - i * osatu[0] > 5000 * (n - i)) {
			} else {
				for (int j = 0; j + i <= n; j++) {
					if (y - i * osatu[0] - j * osatu[1] - (n - i - j) * osatu[2] == 0) {
						ans[0] = i;
						ans[1] = j;
						ans[2] = n - i - j;
					}
				}
			}
		}
		System.out.println(ans[0] + " " + ans[1] + " " + ans[2]);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int y = sc.nextInt();
		int osatu[] = { 10000, 5000, 1000 };
		int ans[] = { -1, -1, -1 };
		for (int i = 0; i <= n; i++) {
			if (y - i * osatu[0] > 5000 * (n - i)) {
			} else {
				for (int j = 0; j + i <= n; j++) {
					if (y - i * osatu[0] - j * osatu[1] - (n - i - j) * osatu[2] == 0) {
						ans[0] = i;
						ans[1] = j;
						ans[2] = n - i - j;
					}
				}
			}
		}
		System.out.println(ans[0] + " " + ans[1] + " " + ans[2]);
	} main {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int y = sc.nextInt();
		int osatu[] = { 10000, 5000, 1000 };
		int ans[] = { -1, -1, -1 };
		for (int i = 0; i <= n; i++) {
			if (y - i * osatu[0] > 5000 * (n - i)) {
			} else {
				for (int j = 0; j + i <= n; j++) {
					if (y - i * osatu[0] - j * osatu[1] - (n - i - j) * osatu[2] == 0) {
						ans[0] = i;
						ans[1] = j;
						ans[2] = n - i - j;
					}
				}
			}
		}
		System.out.println(ans[0] + " " + ans[1] + " " + ans[2]);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) StringBuilder sb = new StringBuilder(); sb new StringBuilder() int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int y = sc.nextInt(); y sc.nextInt() sc.nextInt sc int osatu[] = { 10000, 5000, 1000 }; osatu { 10000, 5000, 1000 } 10000 5000 1000 int ans[] = { -1, -1, -1 }; ans { -1, -1, -1 } -1 1 -1 1 -1 1 for (int i = 0; i <= n; i++) {
			if (y - i * osatu[0] > 5000 * (n - i)) {
			} else {
				for (int j = 0; j + i <= n; j++) {
					if (y - i * osatu[0] - j * osatu[1] - (n - i - j) * osatu[2] == 0) {
						ans[0] = i;
						ans[1] = j;
						ans[2] = n - i - j;
					}
				}
			}
		} int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
			if (y - i * osatu[0] > 5000 * (n - i)) {
			} else {
				for (int j = 0; j + i <= n; j++) {
					if (y - i * osatu[0] - j * osatu[1] - (n - i - j) * osatu[2] == 0) {
						ans[0] = i;
						ans[1] = j;
						ans[2] = n - i - j;
					}
				}
			}
		} {
			if (y - i * osatu[0] > 5000 * (n - i)) {
			} else {
				for (int j = 0; j + i <= n; j++) {
					if (y - i * osatu[0] - j * osatu[1] - (n - i - j) * osatu[2] == 0) {
						ans[0] = i;
						ans[1] = j;
						ans[2] = n - i - j;
					}
				}
			}
		} if (y - i * osatu[0] > 5000 * (n - i)) {
			} else {
				for (int j = 0; j + i <= n; j++) {
					if (y - i * osatu[0] - j * osatu[1] - (n - i - j) * osatu[2] == 0) {
						ans[0] = i;
						ans[1] = j;
						ans[2] = n - i - j;
					}
				}
			} y - i * osatu[0] > 5000 * (n - i) y - i * osatu[0] y i * osatu[0] i osatu[0] osatu 0 5000 * (n - i) 5000 (n - i) n i {
			} {
				for (int j = 0; j + i <= n; j++) {
					if (y - i * osatu[0] - j * osatu[1] - (n - i - j) * osatu[2] == 0) {
						ans[0] = i;
						ans[1] = j;
						ans[2] = n - i - j;
					}
				}
			} for (int j = 0; j + i <= n; j++) {
					if (y - i * osatu[0] - j * osatu[1] - (n - i - j) * osatu[2] == 0) {
						ans[0] = i;
						ans[1] = j;
						ans[2] = n - i - j;
					}
				} int j = 0; int j = 0; j 0 j + i <= n j + i j i n j++ j++ j {
					if (y - i * osatu[0] - j * osatu[1] - (n - i - j) * osatu[2] == 0) {
						ans[0] = i;
						ans[1] = j;
						ans[2] = n - i - j;
					}
				} {
					if (y - i * osatu[0] - j * osatu[1] - (n - i - j) * osatu[2] == 0) {
						ans[0] = i;
						ans[1] = j;
						ans[2] = n - i - j;
					}
				} if (y - i * osatu[0] - j * osatu[1] - (n - i - j) * osatu[2] == 0) {
						ans[0] = i;
						ans[1] = j;
						ans[2] = n - i - j;
					} y - i * osatu[0] - j * osatu[1] - (n - i - j) * osatu[2] == 0 y - i * osatu[0] - j * osatu[1] - (n - i - j) * osatu[2] j * osatu[1] y - i * osatu[0] - j * osatu[1] - (n - i - j) * osatu[2] y i * osatu[0] i osatu[0] osatu 0 j * osatu[1] j osatu[1] osatu 1 (n - i - j) * osatu[2] (n - i - j) n - i - j n i j osatu[2] osatu 2 0 {
						ans[0] = i;
						ans[1] = j;
						ans[2] = n - i - j;
					} ans[0] = i ans[0] ans 0 i ans[1] = j ans[1] ans 1 j ans[2] = n - i - j ans[2] ans 2 n - i - j n - i - j n i j System.out.println(ans[0] + " " + ans[1] + " " + ans[2]) System.out.println System.out System System.out ans[0] + " " + ans[1] + " " + ans[2] " " ans[1] ans[0] + " " + ans[1] + " " + ans[2] ans[0] ans 0 " " ans[1] ans 1 " " ans[2] ans 2 String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int y = sc.nextInt();
		int osatu[] = { 10000, 5000, 1000 };
		int ans[] = { -1, -1, -1 };
		for (int i = 0; i <= n; i++) {
			if (y - i * osatu[0] > 5000 * (n - i)) {
			} else {
				for (int j = 0; j + i <= n; j++) {
					if (y - i * osatu[0] - j * osatu[1] - (n - i - j) * osatu[2] == 0) {
						ans[0] = i;
						ans[1] = j;
						ans[2] = n - i - j;
					}
				}
			}
		}
		System.out.println(ans[0] + " " + ans[1] + " " + ans[2]);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int y = sc.nextInt();
		int osatu[] = { 10000, 5000, 1000 };
		int ans[] = { -1, -1, -1 };
		for (int i = 0; i <= n; i++) {
			if (y - i * osatu[0] > 5000 * (n - i)) {
			} else {
				for (int j = 0; j + i <= n; j++) {
					if (y - i * osatu[0] - j * osatu[1] - (n - i - j) * osatu[2] == 0) {
						ans[0] = i;
						ans[1] = j;
						ans[2] = n - i - j;
					}
				}
			}
		}
		System.out.println(ans[0] + " " + ans[1] + " " + ans[2]);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int y = sc.nextInt();
		int osatu[] = { 10000, 5000, 1000 };
		int ans[] = { -1, -1, -1 };
		for (int i = 0; i <= n; i++) {
			if (y - i * osatu[0] > 5000 * (n - i)) {
			} else {
				for (int j = 0; j + i <= n; j++) {
					if (y - i * osatu[0] - j * osatu[1] - (n - i - j) * osatu[2] == 0) {
						ans[0] = i;
						ans[1] = j;
						ans[2] = n - i - j;
					}
				}
			}
		}
		System.out.println(ans[0] + " " + ans[1] + " " + ans[2]);
	}
}
