import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int Y = scan.nextInt();
			
			int K = Y/10000;
			int goukei=0;
			
			for(int i =0;i<=K;i++) {
				goukei+=i;
				int g = Y-i*10000;
				int G = g/5000;
				for(int z = 0;z<=G;z++) {
					goukei+=z;
					int W= g-z*5000;
					if(i+z+W/1000==N) {
						System.out.print(i);
						System.out.print(" ");
						System.out.print(z);
						System.out.print(" ");
						System.out.println(W/1000);
						System.exit(0);
					}
					
				}
				
			}
			
			System.out.println("-1 -1 -1");
			
		}
		
		
	}
		

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int Y = scan.nextInt();
			
			int K = Y/10000;
			int goukei=0;
			
			for(int i =0;i<=K;i++) {
				goukei+=i;
				int g = Y-i*10000;
				int G = g/5000;
				for(int z = 0;z<=G;z++) {
					goukei+=z;
					int W= g-z*5000;
					if(i+z+W/1000==N) {
						System.out.print(i);
						System.out.print(" ");
						System.out.print(z);
						System.out.print(" ");
						System.out.println(W/1000);
						System.exit(0);
					}
					
				}
				
			}
			
			System.out.println("-1 -1 -1");
			
		}
		
		
	}
		

} Main public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int Y = scan.nextInt();
			
			int K = Y/10000;
			int goukei=0;
			
			for(int i =0;i<=K;i++) {
				goukei+=i;
				int g = Y-i*10000;
				int G = g/5000;
				for(int z = 0;z<=G;z++) {
					goukei+=z;
					int W= g-z*5000;
					if(i+z+W/1000==N) {
						System.out.print(i);
						System.out.print(" ");
						System.out.print(z);
						System.out.print(" ");
						System.out.println(W/1000);
						System.exit(0);
					}
					
				}
				
			}
			
			System.out.println("-1 -1 -1");
			
		}
		
		
	} main {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int Y = scan.nextInt();
			
			int K = Y/10000;
			int goukei=0;
			
			for(int i =0;i<=K;i++) {
				goukei+=i;
				int g = Y-i*10000;
				int G = g/5000;
				for(int z = 0;z<=G;z++) {
					goukei+=z;
					int W= g-z*5000;
					if(i+z+W/1000==N) {
						System.out.print(i);
						System.out.print(" ");
						System.out.print(z);
						System.out.print(" ");
						System.out.println(W/1000);
						System.exit(0);
					}
					
				}
				
			}
			
			System.out.println("-1 -1 -1");
			
		}
		
		
	} try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int Y = scan.nextInt();
			
			int K = Y/10000;
			int goukei=0;
			
			for(int i =0;i<=K;i++) {
				goukei+=i;
				int g = Y-i*10000;
				int G = g/5000;
				for(int z = 0;z<=G;z++) {
					goukei+=z;
					int W= g-z*5000;
					if(i+z+W/1000==N) {
						System.out.print(i);
						System.out.print(" ");
						System.out.print(z);
						System.out.print(" ");
						System.out.println(W/1000);
						System.exit(0);
					}
					
				}
				
			}
			
			System.out.println("-1 -1 -1");
			
		} {
			int N = scan.nextInt();
			int Y = scan.nextInt();
			
			int K = Y/10000;
			int goukei=0;
			
			for(int i =0;i<=K;i++) {
				goukei+=i;
				int g = Y-i*10000;
				int G = g/5000;
				for(int z = 0;z<=G;z++) {
					goukei+=z;
					int W= g-z*5000;
					if(i+z+W/1000==N) {
						System.out.print(i);
						System.out.print(" ");
						System.out.print(z);
						System.out.print(" ");
						System.out.println(W/1000);
						System.exit(0);
					}
					
				}
				
			}
			
			System.out.println("-1 -1 -1");
			
		} Scanner scan = new Scanner(System.in) Scanner scan = new Scanner(System.in) new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int Y = scan.nextInt(); Y scan.nextInt() scan.nextInt scan int K = Y/10000; K Y/10000 Y 10000 int goukei=0; goukei 0 for(int i =0;i<=K;i++) {
				goukei+=i;
				int g = Y-i*10000;
				int G = g/5000;
				for(int z = 0;z<=G;z++) {
					goukei+=z;
					int W= g-z*5000;
					if(i+z+W/1000==N) {
						System.out.print(i);
						System.out.print(" ");
						System.out.print(z);
						System.out.print(" ");
						System.out.println(W/1000);
						System.exit(0);
					}
					
				}
				
			} int i =0; int i =0; i 0 i<=K i K i++ i++ i {
				goukei+=i;
				int g = Y-i*10000;
				int G = g/5000;
				for(int z = 0;z<=G;z++) {
					goukei+=z;
					int W= g-z*5000;
					if(i+z+W/1000==N) {
						System.out.print(i);
						System.out.print(" ");
						System.out.print(z);
						System.out.print(" ");
						System.out.println(W/1000);
						System.exit(0);
					}
					
				}
				
			} {
				goukei+=i;
				int g = Y-i*10000;
				int G = g/5000;
				for(int z = 0;z<=G;z++) {
					goukei+=z;
					int W= g-z*5000;
					if(i+z+W/1000==N) {
						System.out.print(i);
						System.out.print(" ");
						System.out.print(z);
						System.out.print(" ");
						System.out.println(W/1000);
						System.exit(0);
					}
					
				}
				
			} goukei+=i goukei i int g = Y-i*10000; g Y-i*10000 Y i*10000 i 10000 int G = g/5000; G g/5000 g 5000 for(int z = 0;z<=G;z++) {
					goukei+=z;
					int W= g-z*5000;
					if(i+z+W/1000==N) {
						System.out.print(i);
						System.out.print(" ");
						System.out.print(z);
						System.out.print(" ");
						System.out.println(W/1000);
						System.exit(0);
					}
					
				} int z = 0; int z = 0; z 0 z<=G z G z++ z++ z {
					goukei+=z;
					int W= g-z*5000;
					if(i+z+W/1000==N) {
						System.out.print(i);
						System.out.print(" ");
						System.out.print(z);
						System.out.print(" ");
						System.out.println(W/1000);
						System.exit(0);
					}
					
				} {
					goukei+=z;
					int W= g-z*5000;
					if(i+z+W/1000==N) {
						System.out.print(i);
						System.out.print(" ");
						System.out.print(z);
						System.out.print(" ");
						System.out.println(W/1000);
						System.exit(0);
					}
					
				} goukei+=z goukei z int W= g-z*5000; W g-z*5000 g z*5000 z 5000 if(i+z+W/1000==N) {
						System.out.print(i);
						System.out.print(" ");
						System.out.print(z);
						System.out.print(" ");
						System.out.println(W/1000);
						System.exit(0);
					} i+z+W/1000==N i+z+W/1000 i+z+W/1000 i z W/1000 W 1000 N {
						System.out.print(i);
						System.out.print(" ");
						System.out.print(z);
						System.out.print(" ");
						System.out.println(W/1000);
						System.exit(0);
					} System.out.print(i) System.out.print System.out System System.out i System.out.print(" ") System.out.print System.out System System.out " " System.out.print(z) System.out.print System.out System System.out z System.out.print(" ") System.out.print System.out System System.out " " System.out.println(W/1000) System.out.println System.out System System.out W/1000 W 1000 System.exit(0) System.exit System 0 System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" String[]args args public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int Y = scan.nextInt();
			
			int K = Y/10000;
			int goukei=0;
			
			for(int i =0;i<=K;i++) {
				goukei+=i;
				int g = Y-i*10000;
				int G = g/5000;
				for(int z = 0;z<=G;z++) {
					goukei+=z;
					int W= g-z*5000;
					if(i+z+W/1000==N) {
						System.out.print(i);
						System.out.print(" ");
						System.out.print(z);
						System.out.print(" ");
						System.out.println(W/1000);
						System.exit(0);
					}
					
				}
				
			}
			
			System.out.println("-1 -1 -1");
			
		}
		
		
	}
		

} public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int Y = scan.nextInt();
			
			int K = Y/10000;
			int goukei=0;
			
			for(int i =0;i<=K;i++) {
				goukei+=i;
				int g = Y-i*10000;
				int G = g/5000;
				for(int z = 0;z<=G;z++) {
					goukei+=z;
					int W= g-z*5000;
					if(i+z+W/1000==N) {
						System.out.print(i);
						System.out.print(" ");
						System.out.print(z);
						System.out.print(" ");
						System.out.println(W/1000);
						System.exit(0);
					}
					
				}
				
			}
			
			System.out.println("-1 -1 -1");
			
		}
		
		
	}
		

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int Y = scan.nextInt();
			
			int K = Y/10000;
			int goukei=0;
			
			for(int i =0;i<=K;i++) {
				goukei+=i;
				int g = Y-i*10000;
				int G = g/5000;
				for(int z = 0;z<=G;z++) {
					goukei+=z;
					int W= g-z*5000;
					if(i+z+W/1000==N) {
						System.out.print(i);
						System.out.print(" ");
						System.out.print(z);
						System.out.print(" ");
						System.out.println(W/1000);
						System.exit(0);
					}
					
				}
				
			}
			
			System.out.println("-1 -1 -1");
			
		}
		
		
	}
		

}
