import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		boolean t = false;
		for (int x = 0; x <= N && t == false; x++) {
			for (int y = 0; y <= N && t == false; y++) {
				int sum = x * 10000 + y * 5000;
				if (Y - sum >= 0) {
					int z = (Y - sum) % 1000 == 0 ? (Y - sum) / 1000 : 0;
					sum = sum + z * 1000;
					if (x + y + z == N) {
						System.out.println(x + " " + y + " " + z);
						t = true;
					}
				}
			}
		}
		if (t == false) {
			System.out.println("-1 -1 -1");
		}
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		boolean t = false;
		for (int x = 0; x <= N && t == false; x++) {
			for (int y = 0; y <= N && t == false; y++) {
				int sum = x * 10000 + y * 5000;
				if (Y - sum >= 0) {
					int z = (Y - sum) % 1000 == 0 ? (Y - sum) / 1000 : 0;
					sum = sum + z * 1000;
					if (x + y + z == N) {
						System.out.println(x + " " + y + " " + z);
						t = true;
					}
				}
			}
		}
		if (t == false) {
			System.out.println("-1 -1 -1");
		}
		sc.close();
	}
} Main public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		boolean t = false;
		for (int x = 0; x <= N && t == false; x++) {
			for (int y = 0; y <= N && t == false; y++) {
				int sum = x * 10000 + y * 5000;
				if (Y - sum >= 0) {
					int z = (Y - sum) % 1000 == 0 ? (Y - sum) / 1000 : 0;
					sum = sum + z * 1000;
					if (x + y + z == N) {
						System.out.println(x + " " + y + " " + z);
						t = true;
					}
				}
			}
		}
		if (t == false) {
			System.out.println("-1 -1 -1");
		}
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		boolean t = false;
		for (int x = 0; x <= N && t == false; x++) {
			for (int y = 0; y <= N && t == false; y++) {
				int sum = x * 10000 + y * 5000;
				if (Y - sum >= 0) {
					int z = (Y - sum) % 1000 == 0 ? (Y - sum) / 1000 : 0;
					sum = sum + z * 1000;
					if (x + y + z == N) {
						System.out.println(x + " " + y + " " + z);
						t = true;
					}
				}
			}
		}
		if (t == false) {
			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 boolean t = false; t false for (int x = 0; x <= N && t == false; x++) {
			for (int y = 0; y <= N && t == false; y++) {
				int sum = x * 10000 + y * 5000;
				if (Y - sum >= 0) {
					int z = (Y - sum) % 1000 == 0 ? (Y - sum) / 1000 : 0;
					sum = sum + z * 1000;
					if (x + y + z == N) {
						System.out.println(x + " " + y + " " + z);
						t = true;
					}
				}
			}
		} int x = 0; int x = 0; x 0 x <= N && t == false x <= N x N t == false t false x++ x++ x {
			for (int y = 0; y <= N && t == false; y++) {
				int sum = x * 10000 + y * 5000;
				if (Y - sum >= 0) {
					int z = (Y - sum) % 1000 == 0 ? (Y - sum) / 1000 : 0;
					sum = sum + z * 1000;
					if (x + y + z == N) {
						System.out.println(x + " " + y + " " + z);
						t = true;
					}
				}
			}
		} {
			for (int y = 0; y <= N && t == false; y++) {
				int sum = x * 10000 + y * 5000;
				if (Y - sum >= 0) {
					int z = (Y - sum) % 1000 == 0 ? (Y - sum) / 1000 : 0;
					sum = sum + z * 1000;
					if (x + y + z == N) {
						System.out.println(x + " " + y + " " + z);
						t = true;
					}
				}
			}
		} for (int y = 0; y <= N && t == false; y++) {
				int sum = x * 10000 + y * 5000;
				if (Y - sum >= 0) {
					int z = (Y - sum) % 1000 == 0 ? (Y - sum) / 1000 : 0;
					sum = sum + z * 1000;
					if (x + y + z == N) {
						System.out.println(x + " " + y + " " + z);
						t = true;
					}
				}
			} int y = 0; int y = 0; y 0 y <= N && t == false y <= N y N t == false t false y++ y++ y {
				int sum = x * 10000 + y * 5000;
				if (Y - sum >= 0) {
					int z = (Y - sum) % 1000 == 0 ? (Y - sum) / 1000 : 0;
					sum = sum + z * 1000;
					if (x + y + z == N) {
						System.out.println(x + " " + y + " " + z);
						t = true;
					}
				}
			} {
				int sum = x * 10000 + y * 5000;
				if (Y - sum >= 0) {
					int z = (Y - sum) % 1000 == 0 ? (Y - sum) / 1000 : 0;
					sum = sum + z * 1000;
					if (x + y + z == N) {
						System.out.println(x + " " + y + " " + z);
						t = true;
					}
				}
			} int sum = x * 10000 + y * 5000; sum x * 10000 + y * 5000 x * 10000 x 10000 y * 5000 y 5000 if (Y - sum >= 0) {
					int z = (Y - sum) % 1000 == 0 ? (Y - sum) / 1000 : 0;
					sum = sum + z * 1000;
					if (x + y + z == N) {
						System.out.println(x + " " + y + " " + z);
						t = true;
					}
				} Y - sum >= 0 Y - sum Y sum 0 {
					int z = (Y - sum) % 1000 == 0 ? (Y - sum) / 1000 : 0;
					sum = sum + z * 1000;
					if (x + y + z == N) {
						System.out.println(x + " " + y + " " + z);
						t = true;
					}
				} int z = (Y - sum) % 1000 == 0 ? (Y - sum) / 1000 : 0; z (Y - sum) % 1000 == 0 ? (Y - sum) / 1000 : 0 (Y - sum) % 1000 == 0 (Y - sum) % 1000 (Y - sum) Y sum 1000 0 (Y - sum) / 1000 (Y - sum) Y sum 1000 0 sum = sum + z * 1000 sum sum + z * 1000 sum z * 1000 z 1000 if (x + y + z == N) {
						System.out.println(x + " " + y + " " + z);
						t = true;
					} x + y + z == N x + y + z x + y + z x y z N {
						System.out.println(x + " " + y + " " + z);
						t = true;
					} System.out.println(x + " " + y + " " + z) System.out.println System.out System System.out x + " " + y + " " + z " " y x + " " + y + " " + z x " " y " " z t = true t true if (t == false) {
			System.out.println("-1 -1 -1");
		} t == false t false {
			System.out.println("-1 -1 -1");
		} 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) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		boolean t = false;
		for (int x = 0; x <= N && t == false; x++) {
			for (int y = 0; y <= N && t == false; y++) {
				int sum = x * 10000 + y * 5000;
				if (Y - sum >= 0) {
					int z = (Y - sum) % 1000 == 0 ? (Y - sum) / 1000 : 0;
					sum = sum + z * 1000;
					if (x + y + z == N) {
						System.out.println(x + " " + y + " " + z);
						t = true;
					}
				}
			}
		}
		if (t == false) {
			System.out.println("-1 -1 -1");
		}
		sc.close();
	}
} public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		boolean t = false;
		for (int x = 0; x <= N && t == false; x++) {
			for (int y = 0; y <= N && t == false; y++) {
				int sum = x * 10000 + y * 5000;
				if (Y - sum >= 0) {
					int z = (Y - sum) % 1000 == 0 ? (Y - sum) / 1000 : 0;
					sum = sum + z * 1000;
					if (x + y + z == N) {
						System.out.println(x + " " + y + " " + z);
						t = true;
					}
				}
			}
		}
		if (t == false) {
			System.out.println("-1 -1 -1");
		}
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		boolean t = false;
		for (int x = 0; x <= N && t == false; x++) {
			for (int y = 0; y <= N && t == false; y++) {
				int sum = x * 10000 + y * 5000;
				if (Y - sum >= 0) {
					int z = (Y - sum) % 1000 == 0 ? (Y - sum) / 1000 : 0;
					sum = sum + z * 1000;
					if (x + y + z == N) {
						System.out.println(x + " " + y + " " + z);
						t = true;
					}
				}
			}
		}
		if (t == false) {
			System.out.println("-1 -1 -1");
		}
		sc.close();
	}
}