import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), Y = sc.nextInt() / 1000;
		boolean find = false;
		for(int x = 0; x <= N && x * 10 <= Y; x++) {
			for(int y = 0; x + y <= N && x * 10 + y * 5 <= Y; y++) {
				if(Y - 10 * x - 5 * y == N - x - y) {
					find = true;
					System.out.println(x + " " + y + " " + (N - x - y));
					break;
				}
			}
			if(find) break;
		}
		if(!find) System.out.println("-1 -1 -1");
	}
} 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(), Y = sc.nextInt() / 1000;
		boolean find = false;
		for(int x = 0; x <= N && x * 10 <= Y; x++) {
			for(int y = 0; x + y <= N && x * 10 + y * 5 <= Y; y++) {
				if(Y - 10 * x - 5 * y == N - x - y) {
					find = true;
					System.out.println(x + " " + y + " " + (N - x - y));
					break;
				}
			}
			if(find) break;
		}
		if(!find) System.out.println("-1 -1 -1");
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), Y = sc.nextInt() / 1000;
		boolean find = false;
		for(int x = 0; x <= N && x * 10 <= Y; x++) {
			for(int y = 0; x + y <= N && x * 10 + y * 5 <= Y; y++) {
				if(Y - 10 * x - 5 * y == N - x - y) {
					find = true;
					System.out.println(x + " " + y + " " + (N - x - y));
					break;
				}
			}
			if(find) break;
		}
		if(!find) System.out.println("-1 -1 -1");
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), Y = sc.nextInt() / 1000;
		boolean find = false;
		for(int x = 0; x <= N && x * 10 <= Y; x++) {
			for(int y = 0; x + y <= N && x * 10 + y * 5 <= Y; y++) {
				if(Y - 10 * x - 5 * y == N - x - y) {
					find = true;
					System.out.println(x + " " + y + " " + (N - x - y));
					break;
				}
			}
			if(find) break;
		}
		if(!find) System.out.println("-1 -1 -1");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt() N sc.nextInt() sc.nextInt sc Y = sc.nextInt() / 1000; Y sc.nextInt() / 1000 sc.nextInt() sc.nextInt sc 1000 boolean find = false; find false for(int x = 0; x <= N && x * 10 <= Y; x++) {
			for(int y = 0; x + y <= N && x * 10 + y * 5 <= Y; y++) {
				if(Y - 10 * x - 5 * y == N - x - y) {
					find = true;
					System.out.println(x + " " + y + " " + (N - x - y));
					break;
				}
			}
			if(find) break;
		} int x = 0; int x = 0; x 0 x <= N && x * 10 <= Y x <= N x N x * 10 <= Y x * 10 x 10 Y x++ x++ x {
			for(int y = 0; x + y <= N && x * 10 + y * 5 <= Y; y++) {
				if(Y - 10 * x - 5 * y == N - x - y) {
					find = true;
					System.out.println(x + " " + y + " " + (N - x - y));
					break;
				}
			}
			if(find) break;
		} {
			for(int y = 0; x + y <= N && x * 10 + y * 5 <= Y; y++) {
				if(Y - 10 * x - 5 * y == N - x - y) {
					find = true;
					System.out.println(x + " " + y + " " + (N - x - y));
					break;
				}
			}
			if(find) break;
		} for(int y = 0; x + y <= N && x * 10 + y * 5 <= Y; y++) {
				if(Y - 10 * x - 5 * y == N - x - y) {
					find = true;
					System.out.println(x + " " + y + " " + (N - x - y));
					break;
				}
			} int y = 0; int y = 0; y 0 x + y <= N && x * 10 + y * 5 <= Y x + y <= N x + y x y N x * 10 + y * 5 <= Y x * 10 + y * 5 x * 10 x 10 y * 5 y 5 Y y++ y++ y {
				if(Y - 10 * x - 5 * y == N - x - y) {
					find = true;
					System.out.println(x + " " + y + " " + (N - x - y));
					break;
				}
			} {
				if(Y - 10 * x - 5 * y == N - x - y) {
					find = true;
					System.out.println(x + " " + y + " " + (N - x - y));
					break;
				}
			} if(Y - 10 * x - 5 * y == N - x - y) {
					find = true;
					System.out.println(x + " " + y + " " + (N - x - y));
					break;
				} Y - 10 * x - 5 * y == N - x - y Y - 10 * x - 5 * y Y - 10 * x - 5 * y Y 10 * x 10 x 5 * y 5 y N - x - y N - x - y N x y {
					find = true;
					System.out.println(x + " " + y + " " + (N - x - y));
					break;
				} find = true find true System.out.println(x + " " + y + " " + (N - x - y)) System.out.println System.out System System.out x + " " + y + " " + (N - x - y) " " y x + " " + y + " " + (N - x - y) x " " y " " (N - x - y) N - x - y N x y break; if(find) break; find break; if(!find) System.out.println("-1 -1 -1"); !find find System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" 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(), Y = sc.nextInt() / 1000;
		boolean find = false;
		for(int x = 0; x <= N && x * 10 <= Y; x++) {
			for(int y = 0; x + y <= N && x * 10 + y * 5 <= Y; y++) {
				if(Y - 10 * x - 5 * y == N - x - y) {
					find = true;
					System.out.println(x + " " + y + " " + (N - x - y));
					break;
				}
			}
			if(find) break;
		}
		if(!find) System.out.println("-1 -1 -1");
	}
}