import java.util.Scanner;

public class Main {

	//計算に使う定数
	private static final int BILL10k = 10000;
	private static final int BILL5k  = 5000;
	private static final int BILL1k  = 1000;

	public static void main(String[] args) {

		// 処理対象個数の入力
		Scanner sc = new Scanner(System.in);
		int inputBillNum = sc.nextInt();
		int inputPay = sc.nextInt();

		// 札の枚数の組の初期値を代入
		int num10k = -1;
		int num5k = -1;
		int num1k = -1;

		for(int i = 0;i <= inputBillNum;i++) {
			for(int j = 0;i + j <= inputBillNum;j++) {
				if(i * BILL10k + j * BILL5k + (inputBillNum-(i+j)) * BILL1k == inputPay) {
					num10k = i;
					num5k = j;
					num1k = inputBillNum-(i+j);
					break;
				}else if(num10k * BILL10k + num5k * BILL5k + inputBillNum-(num10k+num5k) * BILL1k > inputPay){
					continue;
				}
			}
		}

		sc.close();

		// 出力
		System.out.println(num10k+" "+num5k+" "+num1k);

	}

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

	//計算に使う定数
	private static final int BILL10k = 10000;
	private static final int BILL5k  = 5000;
	private static final int BILL1k  = 1000;

	public static void main(String[] args) {

		// 処理対象個数の入力
		Scanner sc = new Scanner(System.in);
		int inputBillNum = sc.nextInt();
		int inputPay = sc.nextInt();

		// 札の枚数の組の初期値を代入
		int num10k = -1;
		int num5k = -1;
		int num1k = -1;

		for(int i = 0;i <= inputBillNum;i++) {
			for(int j = 0;i + j <= inputBillNum;j++) {
				if(i * BILL10k + j * BILL5k + (inputBillNum-(i+j)) * BILL1k == inputPay) {
					num10k = i;
					num5k = j;
					num1k = inputBillNum-(i+j);
					break;
				}else if(num10k * BILL10k + num5k * BILL5k + inputBillNum-(num10k+num5k) * BILL1k > inputPay){
					continue;
				}
			}
		}

		sc.close();

		// 出力
		System.out.println(num10k+" "+num5k+" "+num1k);

	}

} Main //計算に使う定数
	private static final int BILL10k = 10000; BILL10k 10000 private static final int BILL5k  = 5000; BILL5k 5000 private static final int BILL1k  = 1000; BILL1k 1000 public static void main(String[] args) {

		// 処理対象個数の入力
		Scanner sc = new Scanner(System.in);
		int inputBillNum = sc.nextInt();
		int inputPay = sc.nextInt();

		// 札の枚数の組の初期値を代入
		int num10k = -1;
		int num5k = -1;
		int num1k = -1;

		for(int i = 0;i <= inputBillNum;i++) {
			for(int j = 0;i + j <= inputBillNum;j++) {
				if(i * BILL10k + j * BILL5k + (inputBillNum-(i+j)) * BILL1k == inputPay) {
					num10k = i;
					num5k = j;
					num1k = inputBillNum-(i+j);
					break;
				}else if(num10k * BILL10k + num5k * BILL5k + inputBillNum-(num10k+num5k) * BILL1k > inputPay){
					continue;
				}
			}
		}

		sc.close();

		// 出力
		System.out.println(num10k+" "+num5k+" "+num1k);

	} main {

		// 処理対象個数の入力
		Scanner sc = new Scanner(System.in);
		int inputBillNum = sc.nextInt();
		int inputPay = sc.nextInt();

		// 札の枚数の組の初期値を代入
		int num10k = -1;
		int num5k = -1;
		int num1k = -1;

		for(int i = 0;i <= inputBillNum;i++) {
			for(int j = 0;i + j <= inputBillNum;j++) {
				if(i * BILL10k + j * BILL5k + (inputBillNum-(i+j)) * BILL1k == inputPay) {
					num10k = i;
					num5k = j;
					num1k = inputBillNum-(i+j);
					break;
				}else if(num10k * BILL10k + num5k * BILL5k + inputBillNum-(num10k+num5k) * BILL1k > inputPay){
					continue;
				}
			}
		}

		sc.close();

		// 出力
		System.out.println(num10k+" "+num5k+" "+num1k);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int inputBillNum = sc.nextInt(); inputBillNum sc.nextInt() sc.nextInt sc int inputPay = sc.nextInt(); inputPay sc.nextInt() sc.nextInt sc int num10k = -1; num10k -1 1 int num5k = -1; num5k -1 1 int num1k = -1; num1k -1 1 for(int i = 0;i <= inputBillNum;i++) {
			for(int j = 0;i + j <= inputBillNum;j++) {
				if(i * BILL10k + j * BILL5k + (inputBillNum-(i+j)) * BILL1k == inputPay) {
					num10k = i;
					num5k = j;
					num1k = inputBillNum-(i+j);
					break;
				}else if(num10k * BILL10k + num5k * BILL5k + inputBillNum-(num10k+num5k) * BILL1k > inputPay){
					continue;
				}
			}
		} int i = 0; int i = 0; i 0 i <= inputBillNum i inputBillNum i++ i++ i {
			for(int j = 0;i + j <= inputBillNum;j++) {
				if(i * BILL10k + j * BILL5k + (inputBillNum-(i+j)) * BILL1k == inputPay) {
					num10k = i;
					num5k = j;
					num1k = inputBillNum-(i+j);
					break;
				}else if(num10k * BILL10k + num5k * BILL5k + inputBillNum-(num10k+num5k) * BILL1k > inputPay){
					continue;
				}
			}
		} {
			for(int j = 0;i + j <= inputBillNum;j++) {
				if(i * BILL10k + j * BILL5k + (inputBillNum-(i+j)) * BILL1k == inputPay) {
					num10k = i;
					num5k = j;
					num1k = inputBillNum-(i+j);
					break;
				}else if(num10k * BILL10k + num5k * BILL5k + inputBillNum-(num10k+num5k) * BILL1k > inputPay){
					continue;
				}
			}
		} for(int j = 0;i + j <= inputBillNum;j++) {
				if(i * BILL10k + j * BILL5k + (inputBillNum-(i+j)) * BILL1k == inputPay) {
					num10k = i;
					num5k = j;
					num1k = inputBillNum-(i+j);
					break;
				}else if(num10k * BILL10k + num5k * BILL5k + inputBillNum-(num10k+num5k) * BILL1k > inputPay){
					continue;
				}
			} int j = 0; int j = 0; j 0 i + j <= inputBillNum i + j i j inputBillNum j++ j++ j {
				if(i * BILL10k + j * BILL5k + (inputBillNum-(i+j)) * BILL1k == inputPay) {
					num10k = i;
					num5k = j;
					num1k = inputBillNum-(i+j);
					break;
				}else if(num10k * BILL10k + num5k * BILL5k + inputBillNum-(num10k+num5k) * BILL1k > inputPay){
					continue;
				}
			} {
				if(i * BILL10k + j * BILL5k + (inputBillNum-(i+j)) * BILL1k == inputPay) {
					num10k = i;
					num5k = j;
					num1k = inputBillNum-(i+j);
					break;
				}else if(num10k * BILL10k + num5k * BILL5k + inputBillNum-(num10k+num5k) * BILL1k > inputPay){
					continue;
				}
			} if(i * BILL10k + j * BILL5k + (inputBillNum-(i+j)) * BILL1k == inputPay) {
					num10k = i;
					num5k = j;
					num1k = inputBillNum-(i+j);
					break;
				}else if(num10k * BILL10k + num5k * BILL5k + inputBillNum-(num10k+num5k) * BILL1k > inputPay){
					continue;
				} i * BILL10k + j * BILL5k + (inputBillNum-(i+j)) * BILL1k == inputPay i * BILL10k + j * BILL5k + (inputBillNum-(i+j)) * BILL1k i * BILL10k + j * BILL5k + (inputBillNum-(i+j)) * BILL1k i * BILL10k i BILL10k j * BILL5k j BILL5k (inputBillNum-(i+j)) * BILL1k (inputBillNum-(i+j)) inputBillNum (i+j) i j BILL1k inputPay {
					num10k = i;
					num5k = j;
					num1k = inputBillNum-(i+j);
					break;
				} num10k = i num10k i num5k = j num5k j num1k = inputBillNum-(i+j) num1k inputBillNum-(i+j) inputBillNum (i+j) i j break; if(num10k * BILL10k + num5k * BILL5k + inputBillNum-(num10k+num5k) * BILL1k > inputPay){
					continue;
				} num10k * BILL10k + num5k * BILL5k + inputBillNum-(num10k+num5k) * BILL1k > inputPay num10k * BILL10k + num5k * BILL5k + inputBillNum-(num10k+num5k) * BILL1k num10k * BILL10k + num5k * BILL5k + inputBillNum num10k * BILL10k + num5k * BILL5k + inputBillNum num10k * BILL10k num10k BILL10k num5k * BILL5k num5k BILL5k inputBillNum (num10k+num5k) * BILL1k (num10k+num5k) num10k num5k BILL1k inputPay {
					continue;
				} continue; sc.close() sc.close sc System.out.println(num10k+" "+num5k+" "+num1k) System.out.println System.out System System.out num10k+" "+num5k+" "+num1k " " num5k num10k+" "+num5k+" "+num1k num10k " " num5k " " num1k String[] args args public class Main {

	//計算に使う定数
	private static final int BILL10k = 10000;
	private static final int BILL5k  = 5000;
	private static final int BILL1k  = 1000;

	public static void main(String[] args) {

		// 処理対象個数の入力
		Scanner sc = new Scanner(System.in);
		int inputBillNum = sc.nextInt();
		int inputPay = sc.nextInt();

		// 札の枚数の組の初期値を代入
		int num10k = -1;
		int num5k = -1;
		int num1k = -1;

		for(int i = 0;i <= inputBillNum;i++) {
			for(int j = 0;i + j <= inputBillNum;j++) {
				if(i * BILL10k + j * BILL5k + (inputBillNum-(i+j)) * BILL1k == inputPay) {
					num10k = i;
					num5k = j;
					num1k = inputBillNum-(i+j);
					break;
				}else if(num10k * BILL10k + num5k * BILL5k + inputBillNum-(num10k+num5k) * BILL1k > inputPay){
					continue;
				}
			}
		}

		sc.close();

		// 出力
		System.out.println(num10k+" "+num5k+" "+num1k);

	}

} public class Main {

	//計算に使う定数
	private static final int BILL10k = 10000;
	private static final int BILL5k  = 5000;
	private static final int BILL1k  = 1000;

	public static void main(String[] args) {

		// 処理対象個数の入力
		Scanner sc = new Scanner(System.in);
		int inputBillNum = sc.nextInt();
		int inputPay = sc.nextInt();

		// 札の枚数の組の初期値を代入
		int num10k = -1;
		int num5k = -1;
		int num1k = -1;

		for(int i = 0;i <= inputBillNum;i++) {
			for(int j = 0;i + j <= inputBillNum;j++) {
				if(i * BILL10k + j * BILL5k + (inputBillNum-(i+j)) * BILL1k == inputPay) {
					num10k = i;
					num5k = j;
					num1k = inputBillNum-(i+j);
					break;
				}else if(num10k * BILL10k + num5k * BILL5k + inputBillNum-(num10k+num5k) * BILL1k > inputPay){
					continue;
				}
			}
		}

		sc.close();

		// 出力
		System.out.println(num10k+" "+num5k+" "+num1k);

	}

} Main
import java.util.Scanner;

public class Main {

	//計算に使う定数
	private static final int BILL10k = 10000;
	private static final int BILL5k  = 5000;
	private static final int BILL1k  = 1000;

	public static void main(String[] args) {

		// 処理対象個数の入力
		Scanner sc = new Scanner(System.in);
		int inputBillNum = sc.nextInt();
		int inputPay = sc.nextInt();

		// 札の枚数の組の初期値を代入
		int num10k = -1;
		int num5k = -1;
		int num1k = -1;

		for(int i = 0;i <= inputBillNum;i++) {
			for(int j = 0;i + j <= inputBillNum;j++) {
				if(i * BILL10k + j * BILL5k + (inputBillNum-(i+j)) * BILL1k == inputPay) {
					num10k = i;
					num5k = j;
					num1k = inputBillNum-(i+j);
					break;
				}else if(num10k * BILL10k + num5k * BILL5k + inputBillNum-(num10k+num5k) * BILL1k > inputPay){
					continue;
				}
			}
		}

		sc.close();

		// 出力
		System.out.println(num10k+" "+num5k+" "+num1k);

	}

}