import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int y = sc.nextInt();
		int x = y / 1000 - n;
		int coefficient1 = 9;	//10000円の係数
		int coefficient2 = 4; //5000円の係数
		int result[] = {-1, -1, -1};
		
		for (int i = 0; i <= n; i++) {
			int tmp = x - (9 * i);
			int tmp2[] = new int[3];
			if (tmp % 4 ==0 && tmp >= 0 && tmp <= 4 * n) {
				tmp2[0] = i;
				tmp2[1] = tmp / 4;
				tmp2[2] = n - tmp2[0] - tmp2[1];
				if (tmp2[2] >= 0 && tmp2[2] <= n) {
					result = tmp2;
					break;
				}
			}
		}
		
		System.out.println(result[0] + " " + result[1] + " " + result[2]);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int y = sc.nextInt();
		int x = y / 1000 - n;
		int coefficient1 = 9;	//10000円の係数
		int coefficient2 = 4; //5000円の係数
		int result[] = {-1, -1, -1};
		
		for (int i = 0; i <= n; i++) {
			int tmp = x - (9 * i);
			int tmp2[] = new int[3];
			if (tmp % 4 ==0 && tmp >= 0 && tmp <= 4 * n) {
				tmp2[0] = i;
				tmp2[1] = tmp / 4;
				tmp2[2] = n - tmp2[0] - tmp2[1];
				if (tmp2[2] >= 0 && tmp2[2] <= n) {
					result = tmp2;
					break;
				}
			}
		}
		
		System.out.println(result[0] + " " + result[1] + " " + result[2]);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int y = sc.nextInt();
		int x = y / 1000 - n;
		int coefficient1 = 9;	//10000円の係数
		int coefficient2 = 4; //5000円の係数
		int result[] = {-1, -1, -1};
		
		for (int i = 0; i <= n; i++) {
			int tmp = x - (9 * i);
			int tmp2[] = new int[3];
			if (tmp % 4 ==0 && tmp >= 0 && tmp <= 4 * n) {
				tmp2[0] = i;
				tmp2[1] = tmp / 4;
				tmp2[2] = n - tmp2[0] - tmp2[1];
				if (tmp2[2] >= 0 && tmp2[2] <= n) {
					result = tmp2;
					break;
				}
			}
		}
		
		System.out.println(result[0] + " " + result[1] + " " + result[2]);
	} main {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int y = sc.nextInt();
		int x = y / 1000 - n;
		int coefficient1 = 9;	//10000円の係数
		int coefficient2 = 4; //5000円の係数
		int result[] = {-1, -1, -1};
		
		for (int i = 0; i <= n; i++) {
			int tmp = x - (9 * i);
			int tmp2[] = new int[3];
			if (tmp % 4 ==0 && tmp >= 0 && tmp <= 4 * n) {
				tmp2[0] = i;
				tmp2[1] = tmp / 4;
				tmp2[2] = n - tmp2[0] - tmp2[1];
				if (tmp2[2] >= 0 && tmp2[2] <= n) {
					result = tmp2;
					break;
				}
			}
		}
		
		System.out.println(result[0] + " " + result[1] + " " + result[2]);
	} 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 x = y / 1000 - n; x y / 1000 - n y / 1000 y 1000 n int coefficient1 = 9; coefficient1 9 int coefficient2 = 4; coefficient2 4 int result[] = {-1, -1, -1}; result {-1, -1, -1} -1 1 -1 1 -1 1 for (int i = 0; i <= n; i++) {
			int tmp = x - (9 * i);
			int tmp2[] = new int[3];
			if (tmp % 4 ==0 && tmp >= 0 && tmp <= 4 * n) {
				tmp2[0] = i;
				tmp2[1] = tmp / 4;
				tmp2[2] = n - tmp2[0] - tmp2[1];
				if (tmp2[2] >= 0 && tmp2[2] <= n) {
					result = tmp2;
					break;
				}
			}
		} int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
			int tmp = x - (9 * i);
			int tmp2[] = new int[3];
			if (tmp % 4 ==0 && tmp >= 0 && tmp <= 4 * n) {
				tmp2[0] = i;
				tmp2[1] = tmp / 4;
				tmp2[2] = n - tmp2[0] - tmp2[1];
				if (tmp2[2] >= 0 && tmp2[2] <= n) {
					result = tmp2;
					break;
				}
			}
		} {
			int tmp = x - (9 * i);
			int tmp2[] = new int[3];
			if (tmp % 4 ==0 && tmp >= 0 && tmp <= 4 * n) {
				tmp2[0] = i;
				tmp2[1] = tmp / 4;
				tmp2[2] = n - tmp2[0] - tmp2[1];
				if (tmp2[2] >= 0 && tmp2[2] <= n) {
					result = tmp2;
					break;
				}
			}
		} int tmp = x - (9 * i); tmp x - (9 * i) x (9 * i) 9 i int tmp2[] = new int[3]; tmp2 new int[3] 3 if (tmp % 4 ==0 && tmp >= 0 && tmp <= 4 * n) {
				tmp2[0] = i;
				tmp2[1] = tmp / 4;
				tmp2[2] = n - tmp2[0] - tmp2[1];
				if (tmp2[2] >= 0 && tmp2[2] <= n) {
					result = tmp2;
					break;
				}
			} tmp % 4 ==0 && tmp >= 0 && tmp <= 4 * n tmp % 4 ==0 && tmp >= 0 && tmp <= 4 * n tmp % 4 ==0 tmp % 4 tmp 4 0 tmp >= 0 tmp 0 tmp <= 4 * n tmp 4 * n 4 n {
				tmp2[0] = i;
				tmp2[1] = tmp / 4;
				tmp2[2] = n - tmp2[0] - tmp2[1];
				if (tmp2[2] >= 0 && tmp2[2] <= n) {
					result = tmp2;
					break;
				}
			} tmp2[0] = i tmp2[0] tmp2 0 i tmp2[1] = tmp / 4 tmp2[1] tmp2 1 tmp / 4 tmp 4 tmp2[2] = n - tmp2[0] - tmp2[1] tmp2[2] tmp2 2 n - tmp2[0] - tmp2[1] n - tmp2[0] - tmp2[1] n tmp2[0] tmp2 0 tmp2[1] tmp2 1 if (tmp2[2] >= 0 && tmp2[2] <= n) {
					result = tmp2;
					break;
				} tmp2[2] >= 0 && tmp2[2] <= n tmp2[2] >= 0 tmp2[2] tmp2 2 0 tmp2[2] <= n tmp2[2] tmp2 2 n {
					result = tmp2;
					break;
				} result = tmp2 result tmp2 break; System.out.println(result[0] + " " + result[1] + " " + result[2]) System.out.println System.out System System.out result[0] + " " + result[1] + " " + result[2] " " result[1] result[0] + " " + result[1] + " " + result[2] result[0] result 0 " " result[1] result 1 " " result[2] result 2 String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int y = sc.nextInt();
		int x = y / 1000 - n;
		int coefficient1 = 9;	//10000円の係数
		int coefficient2 = 4; //5000円の係数
		int result[] = {-1, -1, -1};
		
		for (int i = 0; i <= n; i++) {
			int tmp = x - (9 * i);
			int tmp2[] = new int[3];
			if (tmp % 4 ==0 && tmp >= 0 && tmp <= 4 * n) {
				tmp2[0] = i;
				tmp2[1] = tmp / 4;
				tmp2[2] = n - tmp2[0] - tmp2[1];
				if (tmp2[2] >= 0 && tmp2[2] <= n) {
					result = tmp2;
					break;
				}
			}
		}
		
		System.out.println(result[0] + " " + result[1] + " " + result[2]);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int y = sc.nextInt();
		int x = y / 1000 - n;
		int coefficient1 = 9;	//10000円の係数
		int coefficient2 = 4; //5000円の係数
		int result[] = {-1, -1, -1};
		
		for (int i = 0; i <= n; i++) {
			int tmp = x - (9 * i);
			int tmp2[] = new int[3];
			if (tmp % 4 ==0 && tmp >= 0 && tmp <= 4 * n) {
				tmp2[0] = i;
				tmp2[1] = tmp / 4;
				tmp2[2] = n - tmp2[0] - tmp2[1];
				if (tmp2[2] >= 0 && tmp2[2] <= n) {
					result = tmp2;
					break;
				}
			}
		}
		
		System.out.println(result[0] + " " + result[1] + " " + result[2]);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int y = sc.nextInt();
		int x = y / 1000 - n;
		int coefficient1 = 9;	//10000円の係数
		int coefficient2 = 4; //5000円の係数
		int result[] = {-1, -1, -1};
		
		for (int i = 0; i <= n; i++) {
			int tmp = x - (9 * i);
			int tmp2[] = new int[3];
			if (tmp % 4 ==0 && tmp >= 0 && tmp <= 4 * n) {
				tmp2[0] = i;
				tmp2[1] = tmp / 4;
				tmp2[2] = n - tmp2[0] - tmp2[1];
				if (tmp2[2] >= 0 && tmp2[2] <= n) {
					result = tmp2;
					break;
				}
			}
		}
		
		System.out.println(result[0] + " " + result[1] + " " + result[2]);
	}
}
