import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		String ans = "";
		for(int x = 0; x <= N; x++) {
			for(int y = 0; y <= N; y++) {
				int z = N - x - y;
				if(z < 0) {
					break;
				}
				int sum = 10000 * x + 5000 * y + 1000 * z;
				if(sum == Y) {
					ans = x + " " + y + " " + z;
				}
			}
		}
		if(ans == "") {
			System.out.println("-1 -1 -1");
		}else {
			System.out.println(ans);
		}
	}
} 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();
		int Y = sc.nextInt();
		String ans = "";
		for(int x = 0; x <= N; x++) {
			for(int y = 0; y <= N; y++) {
				int z = N - x - y;
				if(z < 0) {
					break;
				}
				int sum = 10000 * x + 5000 * y + 1000 * z;
				if(sum == Y) {
					ans = x + " " + y + " " + z;
				}
			}
		}
		if(ans == "") {
			System.out.println("-1 -1 -1");
		}else {
			System.out.println(ans);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		String ans = "";
		for(int x = 0; x <= N; x++) {
			for(int y = 0; y <= N; y++) {
				int z = N - x - y;
				if(z < 0) {
					break;
				}
				int sum = 10000 * x + 5000 * y + 1000 * z;
				if(sum == Y) {
					ans = x + " " + y + " " + z;
				}
			}
		}
		if(ans == "") {
			System.out.println("-1 -1 -1");
		}else {
			System.out.println(ans);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		String ans = "";
		for(int x = 0; x <= N; x++) {
			for(int y = 0; y <= N; y++) {
				int z = N - x - y;
				if(z < 0) {
					break;
				}
				int sum = 10000 * x + 5000 * y + 1000 * z;
				if(sum == Y) {
					ans = x + " " + y + " " + z;
				}
			}
		}
		if(ans == "") {
			System.out.println("-1 -1 -1");
		}else {
			System.out.println(ans);
		}
	} 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 String ans = ""; ans "" for(int x = 0; x <= N; x++) {
			for(int y = 0; y <= N; y++) {
				int z = N - x - y;
				if(z < 0) {
					break;
				}
				int sum = 10000 * x + 5000 * y + 1000 * z;
				if(sum == Y) {
					ans = x + " " + y + " " + z;
				}
			}
		} int x = 0; int x = 0; x 0 x <= N x N x++ x++ x {
			for(int y = 0; y <= N; y++) {
				int z = N - x - y;
				if(z < 0) {
					break;
				}
				int sum = 10000 * x + 5000 * y + 1000 * z;
				if(sum == Y) {
					ans = x + " " + y + " " + z;
				}
			}
		} {
			for(int y = 0; y <= N; y++) {
				int z = N - x - y;
				if(z < 0) {
					break;
				}
				int sum = 10000 * x + 5000 * y + 1000 * z;
				if(sum == Y) {
					ans = x + " " + y + " " + z;
				}
			}
		} for(int y = 0; y <= N; y++) {
				int z = N - x - y;
				if(z < 0) {
					break;
				}
				int sum = 10000 * x + 5000 * y + 1000 * z;
				if(sum == Y) {
					ans = x + " " + y + " " + z;
				}
			} int y = 0; int y = 0; y 0 y <= N y N y++ y++ y {
				int z = N - x - y;
				if(z < 0) {
					break;
				}
				int sum = 10000 * x + 5000 * y + 1000 * z;
				if(sum == Y) {
					ans = x + " " + y + " " + z;
				}
			} {
				int z = N - x - y;
				if(z < 0) {
					break;
				}
				int sum = 10000 * x + 5000 * y + 1000 * z;
				if(sum == Y) {
					ans = x + " " + y + " " + z;
				}
			} int z = N - x - y; z N - x - y N - x - y N x y if(z < 0) {
					break;
				} z < 0 z 0 {
					break;
				} break; int sum = 10000 * x + 5000 * y + 1000 * z; sum 10000 * x + 5000 * y + 1000 * z 10000 * x + 5000 * y + 1000 * z 10000 * x 10000 x 5000 * y 5000 y 1000 * z 1000 z if(sum == Y) {
					ans = x + " " + y + " " + z;
				} sum == Y sum Y {
					ans = x + " " + y + " " + z;
				} ans = x + " " + y + " " + z ans x + " " + y + " " + z " " y x + " " + y + " " + z x " " y " " z if(ans == "") {
			System.out.println("-1 -1 -1");
		}else {
			System.out.println(ans);
		} ans == "" ans "" {
			System.out.println("-1 -1 -1");
		} System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" {
			System.out.println(ans);
		} System.out.println(ans) System.out.println System.out System System.out ans 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();
		int Y = sc.nextInt();
		String ans = "";
		for(int x = 0; x <= N; x++) {
			for(int y = 0; y <= N; y++) {
				int z = N - x - y;
				if(z < 0) {
					break;
				}
				int sum = 10000 * x + 5000 * y + 1000 * z;
				if(sum == Y) {
					ans = x + " " + y + " " + z;
				}
			}
		}
		if(ans == "") {
			System.out.println("-1 -1 -1");
		}else {
			System.out.println(ans);
		}
	}
}