import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int num = scan.nextInt();
		int amountOfMoney = scan.nextInt();

		scan.close();

		for(int i = 0; i <= num; i++) {
			for(int j = 0; j <= num - i; j++) {
				for(int k = 0 ; k <= num - i - j; k++) {
					if(10000 * i + 5000 * j + 1000 * k == amountOfMoney
						&& i + k + j == num) {
						System.out.println(i + " " + j + " " + k);
						return;
					}
				}
			}
		}
		System.out.println(-1 + " " + -1 + " " + -1);

	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int num = scan.nextInt();
		int amountOfMoney = scan.nextInt();

		scan.close();

		for(int i = 0; i <= num; i++) {
			for(int j = 0; j <= num - i; j++) {
				for(int k = 0 ; k <= num - i - j; k++) {
					if(10000 * i + 5000 * j + 1000 * k == amountOfMoney
						&& i + k + j == num) {
						System.out.println(i + " " + j + " " + k);
						return;
					}
				}
			}
		}
		System.out.println(-1 + " " + -1 + " " + -1);

	}

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int num = scan.nextInt();
		int amountOfMoney = scan.nextInt();

		scan.close();

		for(int i = 0; i <= num; i++) {
			for(int j = 0; j <= num - i; j++) {
				for(int k = 0 ; k <= num - i - j; k++) {
					if(10000 * i + 5000 * j + 1000 * k == amountOfMoney
						&& i + k + j == num) {
						System.out.println(i + " " + j + " " + k);
						return;
					}
				}
			}
		}
		System.out.println(-1 + " " + -1 + " " + -1);

	} main {
		Scanner scan = new Scanner(System.in);

		int num = scan.nextInt();
		int amountOfMoney = scan.nextInt();

		scan.close();

		for(int i = 0; i <= num; i++) {
			for(int j = 0; j <= num - i; j++) {
				for(int k = 0 ; k <= num - i - j; k++) {
					if(10000 * i + 5000 * j + 1000 * k == amountOfMoney
						&& i + k + j == num) {
						System.out.println(i + " " + j + " " + k);
						return;
					}
				}
			}
		}
		System.out.println(-1 + " " + -1 + " " + -1);

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int num = scan.nextInt(); num scan.nextInt() scan.nextInt scan int amountOfMoney = scan.nextInt(); amountOfMoney scan.nextInt() scan.nextInt scan scan.close() scan.close scan for(int i = 0; i <= num; i++) {
			for(int j = 0; j <= num - i; j++) {
				for(int k = 0 ; k <= num - i - j; k++) {
					if(10000 * i + 5000 * j + 1000 * k == amountOfMoney
						&& i + k + j == num) {
						System.out.println(i + " " + j + " " + k);
						return;
					}
				}
			}
		} int i = 0; int i = 0; i 0 i <= num i num i++ i++ i {
			for(int j = 0; j <= num - i; j++) {
				for(int k = 0 ; k <= num - i - j; k++) {
					if(10000 * i + 5000 * j + 1000 * k == amountOfMoney
						&& i + k + j == num) {
						System.out.println(i + " " + j + " " + k);
						return;
					}
				}
			}
		} {
			for(int j = 0; j <= num - i; j++) {
				for(int k = 0 ; k <= num - i - j; k++) {
					if(10000 * i + 5000 * j + 1000 * k == amountOfMoney
						&& i + k + j == num) {
						System.out.println(i + " " + j + " " + k);
						return;
					}
				}
			}
		} for(int j = 0; j <= num - i; j++) {
				for(int k = 0 ; k <= num - i - j; k++) {
					if(10000 * i + 5000 * j + 1000 * k == amountOfMoney
						&& i + k + j == num) {
						System.out.println(i + " " + j + " " + k);
						return;
					}
				}
			} int j = 0; int j = 0; j 0 j <= num - i j num - i num i j++ j++ j {
				for(int k = 0 ; k <= num - i - j; k++) {
					if(10000 * i + 5000 * j + 1000 * k == amountOfMoney
						&& i + k + j == num) {
						System.out.println(i + " " + j + " " + k);
						return;
					}
				}
			} {
				for(int k = 0 ; k <= num - i - j; k++) {
					if(10000 * i + 5000 * j + 1000 * k == amountOfMoney
						&& i + k + j == num) {
						System.out.println(i + " " + j + " " + k);
						return;
					}
				}
			} for(int k = 0 ; k <= num - i - j; k++) {
					if(10000 * i + 5000 * j + 1000 * k == amountOfMoney
						&& i + k + j == num) {
						System.out.println(i + " " + j + " " + k);
						return;
					}
				} int k = 0 ; int k = 0 ; k 0 k <= num - i - j k num - i - j num - i - j num i j k++ k++ k {
					if(10000 * i + 5000 * j + 1000 * k == amountOfMoney
						&& i + k + j == num) {
						System.out.println(i + " " + j + " " + k);
						return;
					}
				} {
					if(10000 * i + 5000 * j + 1000 * k == amountOfMoney
						&& i + k + j == num) {
						System.out.println(i + " " + j + " " + k);
						return;
					}
				} if(10000 * i + 5000 * j + 1000 * k == amountOfMoney
						&& i + k + j == num) {
						System.out.println(i + " " + j + " " + k);
						return;
					} 10000 * i + 5000 * j + 1000 * k == amountOfMoney
						&& i + k + j == num 10000 * i + 5000 * j + 1000 * k == amountOfMoney 10000 * i + 5000 * j + 1000 * k 10000 * i + 5000 * j + 1000 * k 10000 * i 10000 i 5000 * j 5000 j 1000 * k 1000 k amountOfMoney i + k + j == num i + k + j i + k + j i k j num {
						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 " " -1 -1 + " " + -1 + " " + -1 -1 1 " " -1 1 " " -1 1 String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int num = scan.nextInt();
		int amountOfMoney = scan.nextInt();

		scan.close();

		for(int i = 0; i <= num; i++) {
			for(int j = 0; j <= num - i; j++) {
				for(int k = 0 ; k <= num - i - j; k++) {
					if(10000 * i + 5000 * j + 1000 * k == amountOfMoney
						&& i + k + j == num) {
						System.out.println(i + " " + j + " " + k);
						return;
					}
				}
			}
		}
		System.out.println(-1 + " " + -1 + " " + -1);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int num = scan.nextInt();
		int amountOfMoney = scan.nextInt();

		scan.close();

		for(int i = 0; i <= num; i++) {
			for(int j = 0; j <= num - i; j++) {
				for(int k = 0 ; k <= num - i - j; k++) {
					if(10000 * i + 5000 * j + 1000 * k == amountOfMoney
						&& i + k + j == num) {
						System.out.println(i + " " + j + " " + k);
						return;
					}
				}
			}
		}
		System.out.println(-1 + " " + -1 + " " + -1);

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int num = scan.nextInt();
		int amountOfMoney = scan.nextInt();

		scan.close();

		for(int i = 0; i <= num; i++) {
			for(int j = 0; j <= num - i; j++) {
				for(int k = 0 ; k <= num - i - j; k++) {
					if(10000 * i + 5000 * j + 1000 * k == amountOfMoney
						&& i + k + j == num) {
						System.out.println(i + " " + j + " " + k);
						return;
					}
				}
			}
		}
		System.out.println(-1 + " " + -1 + " " + -1);

	}

}