import java.util.Scanner;

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--) {
			for (int j = n - i; j >= 0; j--) {
				int k = n - i - j;
				int yen = 10000 * i + 5000 * j + 1000 * k;
				if (yen == 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 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--) {
			for (int j = n - i; j >= 0; j--) {
				int k = n - i - j;
				int yen = 10000 * i + 5000 * j + 1000 * k;
				if (yen == 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--) {
			for (int j = n - i; j >= 0; j--) {
				int k = n - i - j;
				int yen = 10000 * i + 5000 * j + 1000 * k;
				if (yen == 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--) {
			for (int j = n - i; j >= 0; j--) {
				int k = n - i - j;
				int yen = 10000 * i + 5000 * j + 1000 * k;
				if (yen == 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--) {
			for (int j = n - i; j >= 0; j--) {
				int k = n - i - j;
				int yen = 10000 * i + 5000 * j + 1000 * k;
				if (yen == 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 {
			for (int j = n - i; j >= 0; j--) {
				int k = n - i - j;
				int yen = 10000 * i + 5000 * j + 1000 * k;
				if (yen == y) {
					System.out.println(i + " "
							+ j + " "
							+ k);
					sc.close();
					return;
				}
			}
		} {
			for (int j = n - i; j >= 0; j--) {
				int k = n - i - j;
				int yen = 10000 * i + 5000 * j + 1000 * k;
				if (yen == y) {
					System.out.println(i + " "
							+ j + " "
							+ k);
					sc.close();
					return;
				}
			}
		} for (int j = n - i; j >= 0; j--) {
				int k = n - i - j;
				int yen = 10000 * i + 5000 * j + 1000 * k;
				if (yen == y) {
					System.out.println(i + " "
							+ j + " "
							+ k);
					sc.close();
					return;
				}
			} int j = n - i; int j = n - i; j n - i n i j >= 0 j 0 j-- j-- j {
				int k = n - i - j;
				int yen = 10000 * i + 5000 * j + 1000 * k;
				if (yen == y) {
					System.out.println(i + " "
							+ j + " "
							+ k);
					sc.close();
					return;
				}
			} {
				int k = n - i - j;
				int yen = 10000 * i + 5000 * j + 1000 * k;
				if (yen == y) {
					System.out.println(i + " "
							+ j + " "
							+ k);
					sc.close();
					return;
				}
			} int k = n - i - j; k n - i - j n - i - j n i j int yen = 10000 * i + 5000 * j + 1000 * k; yen 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 (yen == y) {
					System.out.println(i + " "
							+ j + " "
							+ k);
					sc.close();
					return;
				} yen == y yen 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
import java.util.Scanner;

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--) {
			for (int j = n - i; j >= 0; j--) {
				int k = n - i - j;
				int yen = 10000 * i + 5000 * j + 1000 * k;
				if (yen == y) {
					System.out.println(i + " "
							+ j + " "
							+ k);
					sc.close();
					return;
				}
			}
		}

		System.out.println("-1 -1 -1");

		sc.close();
	}
}
