import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt(); //お札の枚数 2*10^3
		int y = stdIn.nextInt(); //金額 2*10^7
		
		
		//boolean flag = false; //実際にその金額になるか
		
		
		for(int i = 0; i <= n; i++) {
			for(int j = 0; j <= n - i; j++) {
				int k = n - i - j; //1000円札の枚数
				
				if(i*10000 + j*5000 + k*1000 == y) {
					System.out.println(i+" "+j+" "+k);
					return;
				}
				
				
			}
		}
		
		System.out.println(-1+" "+-1+" "+-1);
		
		
		
	}

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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt(); //お札の枚数 2*10^3
		int y = stdIn.nextInt(); //金額 2*10^7
		
		
		//boolean flag = false; //実際にその金額になるか
		
		
		for(int i = 0; i <= n; i++) {
			for(int j = 0; j <= n - i; j++) {
				int k = n - i - j; //1000円札の枚数
				
				if(i*10000 + j*5000 + k*1000 == y) {
					System.out.println(i+" "+j+" "+k);
					return;
				}
				
				
			}
		}
		
		System.out.println(-1+" "+-1+" "+-1);
		
		
		
	}

} Main public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt(); //お札の枚数 2*10^3
		int y = stdIn.nextInt(); //金額 2*10^7
		
		
		//boolean flag = false; //実際にその金額になるか
		
		
		for(int i = 0; i <= n; i++) {
			for(int j = 0; j <= n - i; j++) {
				int k = n - i - j; //1000円札の枚数
				
				if(i*10000 + j*5000 + k*1000 == y) {
					System.out.println(i+" "+j+" "+k);
					return;
				}
				
				
			}
		}
		
		System.out.println(-1+" "+-1+" "+-1);
		
		
		
	} main {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt(); //お札の枚数 2*10^3
		int y = stdIn.nextInt(); //金額 2*10^7
		
		
		//boolean flag = false; //実際にその金額になるか
		
		
		for(int i = 0; i <= n; i++) {
			for(int j = 0; j <= n - i; j++) {
				int k = n - i - j; //1000円札の枚数
				
				if(i*10000 + j*5000 + k*1000 == y) {
					System.out.println(i+" "+j+" "+k);
					return;
				}
				
				
			}
		}
		
		System.out.println(-1+" "+-1+" "+-1);
		
		
		
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int n = stdIn.nextInt(); n stdIn.nextInt() stdIn.nextInt stdIn int y = stdIn.nextInt(); y stdIn.nextInt() stdIn.nextInt stdIn for(int i = 0; i <= n; i++) {
			for(int j = 0; j <= n - i; j++) {
				int k = n - i - j; //1000円札の枚数
				
				if(i*10000 + j*5000 + k*1000 == y) {
					System.out.println(i+" "+j+" "+k);
					return;
				}
				
				
			}
		} int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
			for(int j = 0; j <= n - i; j++) {
				int k = n - i - j; //1000円札の枚数
				
				if(i*10000 + j*5000 + k*1000 == y) {
					System.out.println(i+" "+j+" "+k);
					return;
				}
				
				
			}
		} {
			for(int j = 0; j <= n - i; j++) {
				int k = n - i - j; //1000円札の枚数
				
				if(i*10000 + j*5000 + k*1000 == y) {
					System.out.println(i+" "+j+" "+k);
					return;
				}
				
				
			}
		} for(int j = 0; j <= n - i; j++) {
				int k = n - i - j; //1000円札の枚数
				
				if(i*10000 + j*5000 + k*1000 == y) {
					System.out.println(i+" "+j+" "+k);
					return;
				}
				
				
			} int j = 0; int j = 0; j 0 j <= n - i j n - i n i j++ j++ j {
				int k = n - i - j; //1000円札の枚数
				
				if(i*10000 + j*5000 + k*1000 == y) {
					System.out.println(i+" "+j+" "+k);
					return;
				}
				
				
			} {
				int k = n - i - j; //1000円札の枚数
				
				if(i*10000 + j*5000 + k*1000 == y) {
					System.out.println(i+" "+j+" "+k);
					return;
				}
				
				
			} int k = n - i - j; k n - i - j n - i - j n i j if(i*10000 + j*5000 + k*1000 == y) {
					System.out.println(i+" "+j+" "+k);
					return;
				} i*10000 + j*5000 + k*1000 == y i*10000 + j*5000 + k*1000 i*10000 + j*5000 + k*1000 i*10000 i 10000 j*5000 j 5000 k*1000 k 1000 y {
					System.out.println(i+" "+j+" "+k);
					return;
				} System.out.println(i+" "+j+" "+k) System.out.println System.out System System.out i+" "+j+" "+k " " j i+" "+j+" "+k i " " j " " k return; System.out.println(-1+" "+-1+" "+-1) System.out.println System.out System System.out -1+" "+-1+" "+-1 " " -1 -1+" "+-1+" "+-1 -1 1 " " -1 1 " " -1 1 String[] args args public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt(); //お札の枚数 2*10^3
		int y = stdIn.nextInt(); //金額 2*10^7
		
		
		//boolean flag = false; //実際にその金額になるか
		
		
		for(int i = 0; i <= n; i++) {
			for(int j = 0; j <= n - i; j++) {
				int k = n - i - j; //1000円札の枚数
				
				if(i*10000 + j*5000 + k*1000 == y) {
					System.out.println(i+" "+j+" "+k);
					return;
				}
				
				
			}
		}
		
		System.out.println(-1+" "+-1+" "+-1);
		
		
		
	}

} public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt(); //お札の枚数 2*10^3
		int y = stdIn.nextInt(); //金額 2*10^7
		
		
		//boolean flag = false; //実際にその金額になるか
		
		
		for(int i = 0; i <= n; i++) {
			for(int j = 0; j <= n - i; j++) {
				int k = n - i - j; //1000円札の枚数
				
				if(i*10000 + j*5000 + k*1000 == y) {
					System.out.println(i+" "+j+" "+k);
					return;
				}
				
				
			}
		}
		
		System.out.println(-1+" "+-1+" "+-1);
		
		
		
	}

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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt(); //お札の枚数 2*10^3
		int y = stdIn.nextInt(); //金額 2*10^7
		
		
		//boolean flag = false; //実際にその金額になるか
		
		
		for(int i = 0; i <= n; i++) {
			for(int j = 0; j <= n - i; j++) {
				int k = n - i - j; //1000円札の枚数
				
				if(i*10000 + j*5000 + k*1000 == y) {
					System.out.println(i+" "+j+" "+k);
					return;
				}
				
				
			}
		}
		
		System.out.println(-1+" "+-1+" "+-1);
		
		
		
	}

}
