import java.util.*;
import static java.lang.Math.*;

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

		// 入力
		int n = sc.nextInt();// お札の枚数（10000万円札、5000円札、1000円札）
		int y = sc.nextInt();// 合計金額(1000の倍数)

		// 計算
		int countA = -1;
		int countB = -1;
		int countC = -1;

		for(int a = 0; a <= n; a++){
			for(int b = 0; a + b <= n; b++){
				if(10000 * a + 5000 * b + 1000 * (n - a - b) == y){
					countA = a;
					countB = b;
					countC = n - a -b;
				}
			}
		}

		// 出力
		System.out.println(countA + " " + countB + " " + countC);
	}

}

 import java.util.*; util.* java import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		// 入力
		int n = sc.nextInt();// お札の枚数（10000万円札、5000円札、1000円札）
		int y = sc.nextInt();// 合計金額(1000の倍数)

		// 計算
		int countA = -1;
		int countB = -1;
		int countC = -1;

		for(int a = 0; a <= n; a++){
			for(int b = 0; a + b <= n; b++){
				if(10000 * a + 5000 * b + 1000 * (n - a - b) == y){
					countA = a;
					countB = b;
					countC = n - a -b;
				}
			}
		}

		// 出力
		System.out.println(countA + " " + countB + " " + countC);
	}

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

		// 入力
		int n = sc.nextInt();// お札の枚数（10000万円札、5000円札、1000円札）
		int y = sc.nextInt();// 合計金額(1000の倍数)

		// 計算
		int countA = -1;
		int countB = -1;
		int countC = -1;

		for(int a = 0; a <= n; a++){
			for(int b = 0; a + b <= n; b++){
				if(10000 * a + 5000 * b + 1000 * (n - a - b) == y){
					countA = a;
					countB = b;
					countC = n - a -b;
				}
			}
		}

		// 出力
		System.out.println(countA + " " + countB + " " + countC);
	} main {
		Scanner sc = new Scanner(System.in);

		// 入力
		int n = sc.nextInt();// お札の枚数（10000万円札、5000円札、1000円札）
		int y = sc.nextInt();// 合計金額(1000の倍数)

		// 計算
		int countA = -1;
		int countB = -1;
		int countC = -1;

		for(int a = 0; a <= n; a++){
			for(int b = 0; a + b <= n; b++){
				if(10000 * a + 5000 * b + 1000 * (n - a - b) == y){
					countA = a;
					countB = b;
					countC = n - a -b;
				}
			}
		}

		// 出力
		System.out.println(countA + " " + countB + " " + countC);
	} 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 int countA = -1; countA -1 1 int countB = -1; countB -1 1 int countC = -1; countC -1 1 for(int a = 0; a <= n; a++){
			for(int b = 0; a + b <= n; b++){
				if(10000 * a + 5000 * b + 1000 * (n - a - b) == y){
					countA = a;
					countB = b;
					countC = n - a -b;
				}
			}
		} int a = 0; int a = 0; a 0 a <= n a n a++ a++ a {
			for(int b = 0; a + b <= n; b++){
				if(10000 * a + 5000 * b + 1000 * (n - a - b) == y){
					countA = a;
					countB = b;
					countC = n - a -b;
				}
			}
		} {
			for(int b = 0; a + b <= n; b++){
				if(10000 * a + 5000 * b + 1000 * (n - a - b) == y){
					countA = a;
					countB = b;
					countC = n - a -b;
				}
			}
		} for(int b = 0; a + b <= n; b++){
				if(10000 * a + 5000 * b + 1000 * (n - a - b) == y){
					countA = a;
					countB = b;
					countC = n - a -b;
				}
			} int b = 0; int b = 0; b 0 a + b <= n a + b a b n b++ b++ b {
				if(10000 * a + 5000 * b + 1000 * (n - a - b) == y){
					countA = a;
					countB = b;
					countC = n - a -b;
				}
			} {
				if(10000 * a + 5000 * b + 1000 * (n - a - b) == y){
					countA = a;
					countB = b;
					countC = n - a -b;
				}
			} if(10000 * a + 5000 * b + 1000 * (n - a - b) == y){
					countA = a;
					countB = b;
					countC = n - a -b;
				} 10000 * a + 5000 * b + 1000 * (n - a - b) == y 10000 * a + 5000 * b + 1000 * (n - a - b) 10000 * a + 5000 * b + 1000 * (n - a - b) 10000 * a 10000 a 5000 * b 5000 b 1000 * (n - a - b) 1000 (n - a - b) n - a - b n a b y {
					countA = a;
					countB = b;
					countC = n - a -b;
				} countA = a countA a countB = b countB b countC = n - a -b countC n - a -b n - a -b n a b System.out.println(countA + " " + countB + " " + countC) System.out.println System.out System System.out countA + " " + countB + " " + countC " " countB countA + " " + countB + " " + countC countA " " countB " " countC String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		// 入力
		int n = sc.nextInt();// お札の枚数（10000万円札、5000円札、1000円札）
		int y = sc.nextInt();// 合計金額(1000の倍数)

		// 計算
		int countA = -1;
		int countB = -1;
		int countC = -1;

		for(int a = 0; a <= n; a++){
			for(int b = 0; a + b <= n; b++){
				if(10000 * a + 5000 * b + 1000 * (n - a - b) == y){
					countA = a;
					countB = b;
					countC = n - a -b;
				}
			}
		}

		// 出力
		System.out.println(countA + " " + countB + " " + countC);
	}

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

		// 入力
		int n = sc.nextInt();// お札の枚数（10000万円札、5000円札、1000円札）
		int y = sc.nextInt();// 合計金額(1000の倍数)

		// 計算
		int countA = -1;
		int countB = -1;
		int countC = -1;

		for(int a = 0; a <= n; a++){
			for(int b = 0; a + b <= n; b++){
				if(10000 * a + 5000 * b + 1000 * (n - a - b) == y){
					countA = a;
					countB = b;
					countC = n - a -b;
				}
			}
		}

		// 出力
		System.out.println(countA + " " + countB + " " + countC);
	}

} Main
import java.util.*;
import static java.lang.Math.*;

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

		// 入力
		int n = sc.nextInt();// お札の枚数（10000万円札、5000円札、1000円札）
		int y = sc.nextInt();// 合計金額(1000の倍数)

		// 計算
		int countA = -1;
		int countB = -1;
		int countC = -1;

		for(int a = 0; a <= n; a++){
			for(int b = 0; a + b <= n; b++){
				if(10000 * a + 5000 * b + 1000 * (n - a - b) == y){
					countA = a;
					countB = b;
					countC = n - a -b;
				}
			}
		}

		// 出力
		System.out.println(countA + " " + countB + " " + countC);
	}

}


