import java.util.Scanner;

/**
 * TITLE : Otoshidama
 * URL : https://atcoder.jp/contests/abc085/tasks/abc085_c
 */
public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		for (int i = N; i >= 0; i--) {
			if (i * 10000 > Y) continue;
			for (int j = (N - i) * 2; j >= 0; j--) {
				if (i * 10000 + j * 5000 > Y) continue;
				int k = (Y - (i * 10000) - (j * 5000)) / 1000;
				if ((i + j + k) == N && ((i * 10000) + (j * 5000) + (k * 1000)) == Y) {
					System.out.println(i + " " + j + " " + k);
					sc.close();
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		for (int i = N; i >= 0; i--) {
			if (i * 10000 > Y) continue;
			for (int j = (N - i) * 2; j >= 0; j--) {
				if (i * 10000 + j * 5000 > Y) continue;
				int k = (Y - (i * 10000) - (j * 5000)) / 1000;
				if ((i + j + k) == N && ((i * 10000) + (j * 5000) + (k * 1000)) == Y) {
					System.out.println(i + " " + j + " " + k);
					sc.close();
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
		sc.close();
	}
} Main public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		for (int i = N; i >= 0; i--) {
			if (i * 10000 > Y) continue;
			for (int j = (N - i) * 2; j >= 0; j--) {
				if (i * 10000 + j * 5000 > Y) continue;
				int k = (Y - (i * 10000) - (j * 5000)) / 1000;
				if ((i + j + k) == N && ((i * 10000) + (j * 5000) + (k * 1000)) == Y) {
					System.out.println(i + " " + j + " " + k);
					sc.close();
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		for (int i = N; i >= 0; i--) {
			if (i * 10000 > Y) continue;
			for (int j = (N - i) * 2; j >= 0; j--) {
				if (i * 10000 + j * 5000 > Y) continue;
				int k = (Y - (i * 10000) - (j * 5000)) / 1000;
				if ((i + j + k) == N && ((i * 10000) + (j * 5000) + (k * 1000)) == Y) {
					System.out.println(i + " " + j + " " + k);
					sc.close();
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int Y = sc.nextInt(); Y sc.nextInt() sc.nextInt sc for (int i = N; i >= 0; i--) {
			if (i * 10000 > Y) continue;
			for (int j = (N - i) * 2; j >= 0; j--) {
				if (i * 10000 + j * 5000 > Y) continue;
				int k = (Y - (i * 10000) - (j * 5000)) / 1000;
				if ((i + j + k) == N && ((i * 10000) + (j * 5000) + (k * 1000)) == Y) {
					System.out.println(i + " " + j + " " + k);
					sc.close();
					return;
				}
			}
		} int i = N; int i = N; i N i >= 0 i 0 i-- i-- i {
			if (i * 10000 > Y) continue;
			for (int j = (N - i) * 2; j >= 0; j--) {
				if (i * 10000 + j * 5000 > Y) continue;
				int k = (Y - (i * 10000) - (j * 5000)) / 1000;
				if ((i + j + k) == N && ((i * 10000) + (j * 5000) + (k * 1000)) == Y) {
					System.out.println(i + " " + j + " " + k);
					sc.close();
					return;
				}
			}
		} {
			if (i * 10000 > Y) continue;
			for (int j = (N - i) * 2; j >= 0; j--) {
				if (i * 10000 + j * 5000 > Y) continue;
				int k = (Y - (i * 10000) - (j * 5000)) / 1000;
				if ((i + j + k) == N && ((i * 10000) + (j * 5000) + (k * 1000)) == Y) {
					System.out.println(i + " " + j + " " + k);
					sc.close();
					return;
				}
			}
		} if (i * 10000 > Y) continue; i * 10000 > Y i * 10000 i 10000 Y continue; for (int j = (N - i) * 2; j >= 0; j--) {
				if (i * 10000 + j * 5000 > Y) continue;
				int k = (Y - (i * 10000) - (j * 5000)) / 1000;
				if ((i + j + k) == N && ((i * 10000) + (j * 5000) + (k * 1000)) == Y) {
					System.out.println(i + " " + j + " " + k);
					sc.close();
					return;
				}
			} int j = (N - i) * 2; int j = (N - i) * 2; j (N - i) * 2 (N - i) N i 2 j >= 0 j 0 j-- j-- j {
				if (i * 10000 + j * 5000 > Y) continue;
				int k = (Y - (i * 10000) - (j * 5000)) / 1000;
				if ((i + j + k) == N && ((i * 10000) + (j * 5000) + (k * 1000)) == Y) {
					System.out.println(i + " " + j + " " + k);
					sc.close();
					return;
				}
			} {
				if (i * 10000 + j * 5000 > Y) continue;
				int k = (Y - (i * 10000) - (j * 5000)) / 1000;
				if ((i + j + k) == N && ((i * 10000) + (j * 5000) + (k * 1000)) == Y) {
					System.out.println(i + " " + j + " " + k);
					sc.close();
					return;
				}
			} if (i * 10000 + j * 5000 > Y) continue; i * 10000 + j * 5000 > Y i * 10000 + j * 5000 i * 10000 i 10000 j * 5000 j 5000 Y continue; int k = (Y - (i * 10000) - (j * 5000)) / 1000; k (Y - (i * 10000) - (j * 5000)) / 1000 (Y - (i * 10000) - (j * 5000)) Y - (i * 10000) - (j * 5000) Y (i * 10000) i 10000 (j * 5000) j 5000 1000 if ((i + j + k) == N && ((i * 10000) + (j * 5000) + (k * 1000)) == Y) {
					System.out.println(i + " " + j + " " + k);
					sc.close();
					return;
				} (i + j + k) == N && ((i * 10000) + (j * 5000) + (k * 1000)) == Y (i + j + k) == N (i + j + k) i + j + k i j k N ((i * 10000) + (j * 5000) + (k * 1000)) == Y ((i * 10000) + (j * 5000) + (k * 1000)) (i * 10000) + (j * 5000) + (k * 1000) (i * 10000) i 10000 (j * 5000) j 5000 (k * 1000) k 1000 Y {
					System.out.println(i + " " + j + " " + k);
					sc.close();
					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 sc.close() sc.close sc return; System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" sc.close() sc.close sc String args[] args public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		for (int i = N; i >= 0; i--) {
			if (i * 10000 > Y) continue;
			for (int j = (N - i) * 2; j >= 0; j--) {
				if (i * 10000 + j * 5000 > Y) continue;
				int k = (Y - (i * 10000) - (j * 5000)) / 1000;
				if ((i + j + k) == N && ((i * 10000) + (j * 5000) + (k * 1000)) == Y) {
					System.out.println(i + " " + j + " " + k);
					sc.close();
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
		sc.close();
	}
} public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		for (int i = N; i >= 0; i--) {
			if (i * 10000 > Y) continue;
			for (int j = (N - i) * 2; j >= 0; j--) {
				if (i * 10000 + j * 5000 > Y) continue;
				int k = (Y - (i * 10000) - (j * 5000)) / 1000;
				if ((i + j + k) == N && ((i * 10000) + (j * 5000) + (k * 1000)) == Y) {
					System.out.println(i + " " + j + " " + k);
					sc.close();
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
		sc.close();
	}
} Main
import java.util.Scanner;

/**
 * TITLE : Otoshidama
 * URL : https://atcoder.jp/contests/abc085/tasks/abc085_c
 */
public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		for (int i = N; i >= 0; i--) {
			if (i * 10000 > Y) continue;
			for (int j = (N - i) * 2; j >= 0; j--) {
				if (i * 10000 + j * 5000 > Y) continue;
				int k = (Y - (i * 10000) - (j * 5000)) / 1000;
				if ((i + j + k) == N && ((i * 10000) + (j * 5000) + (k * 1000)) == Y) {
					System.out.println(i + " " + j + " " + k);
					sc.close();
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
		sc.close();
	}
}