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