import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int Y = sc.nextInt();

		int[] ans = null;
		for(int m=0;m<=N;m++) {
			for(int g=0;g<=N-m;g++) {
				int s = N-(m+g);
				if(Y == m*10000 + g*5000 + s*1000) {
					ans = new int[] {m,g,s};
				}
			}
		}

		if (ans == null) {
			out.println("-1 -1 -1");
		} else {
			out.println(ans[0] + " " + ans[1] + " " + ans[2]);
		}

		sc.close();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

} import java.io.InputStream; InputStream java.io import java.io.PrintStream; PrintStream java.io import java.util.Scanner; Scanner java.util public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int Y = sc.nextInt();

		int[] ans = null;
		for(int m=0;m<=N;m++) {
			for(int g=0;g<=N-m;g++) {
				int s = N-(m+g);
				if(Y == m*10000 + g*5000 + s*1000) {
					ans = new int[] {m,g,s};
				}
			}
		}

		if (ans == null) {
			out.println("-1 -1 -1");
		} else {
			out.println(ans[0] + " " + ans[1] + " " + ans[2]);
		}

		sc.close();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

} Main InputStream in = System.in; in System.in System System.in PrintStream out = System.out; out System.out System System.out public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int Y = sc.nextInt();

		int[] ans = null;
		for(int m=0;m<=N;m++) {
			for(int g=0;g<=N-m;g++) {
				int s = N-(m+g);
				if(Y == m*10000 + g*5000 + s*1000) {
					ans = new int[] {m,g,s};
				}
			}
		}

		if (ans == null) {
			out.println("-1 -1 -1");
		} else {
			out.println(ans[0] + " " + ans[1] + " " + ans[2]);
		}

		sc.close();

	} _main {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int Y = sc.nextInt();

		int[] ans = null;
		for(int m=0;m<=N;m++) {
			for(int g=0;g<=N-m;g++) {
				int s = N-(m+g);
				if(Y == m*10000 + g*5000 + s*1000) {
					ans = new int[] {m,g,s};
				}
			}
		}

		if (ans == null) {
			out.println("-1 -1 -1");
		} else {
			out.println(ans[0] + " " + ans[1] + " " + ans[2]);
		}

		sc.close();

	} Scanner sc = new Scanner(in); sc new Scanner(in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int Y = sc.nextInt(); Y sc.nextInt() sc.nextInt sc int[] ans = null; ans null for(int m=0;m<=N;m++) {
			for(int g=0;g<=N-m;g++) {
				int s = N-(m+g);
				if(Y == m*10000 + g*5000 + s*1000) {
					ans = new int[] {m,g,s};
				}
			}
		} int m=0; int m=0; m 0 m<=N m N m++ m++ m {
			for(int g=0;g<=N-m;g++) {
				int s = N-(m+g);
				if(Y == m*10000 + g*5000 + s*1000) {
					ans = new int[] {m,g,s};
				}
			}
		} {
			for(int g=0;g<=N-m;g++) {
				int s = N-(m+g);
				if(Y == m*10000 + g*5000 + s*1000) {
					ans = new int[] {m,g,s};
				}
			}
		} for(int g=0;g<=N-m;g++) {
				int s = N-(m+g);
				if(Y == m*10000 + g*5000 + s*1000) {
					ans = new int[] {m,g,s};
				}
			} int g=0; int g=0; g 0 g<=N-m g N-m N m g++ g++ g {
				int s = N-(m+g);
				if(Y == m*10000 + g*5000 + s*1000) {
					ans = new int[] {m,g,s};
				}
			} {
				int s = N-(m+g);
				if(Y == m*10000 + g*5000 + s*1000) {
					ans = new int[] {m,g,s};
				}
			} int s = N-(m+g); s N-(m+g) N (m+g) m g if(Y == m*10000 + g*5000 + s*1000) {
					ans = new int[] {m,g,s};
				} Y == m*10000 + g*5000 + s*1000 Y m*10000 + g*5000 + s*1000 m*10000 + g*5000 + s*1000 m*10000 m 10000 g*5000 g 5000 s*1000 s 1000 {
					ans = new int[] {m,g,s};
				} ans = new int[] {m,g,s} ans new int[] {m,g,s} if (ans == null) {
			out.println("-1 -1 -1");
		} else {
			out.println(ans[0] + " " + ans[1] + " " + ans[2]);
		} ans == null ans null {
			out.println("-1 -1 -1");
		} out.println("-1 -1 -1") out.println out "-1 -1 -1" {
			out.println(ans[0] + " " + ans[1] + " " + ans[2]);
		} out.println(ans[0] + " " + ans[1] + " " + ans[2]) out.println out ans[0] + " " + ans[1] + " " + ans[2] " " ans[1] ans[0] + " " + ans[1] + " " + ans[2] ans[0] ans 0 " " ans[1] ans 1 " " ans[2] ans 2 sc.close() sc.close sc String[] args args public static void main(String[] args) {
		new Main()._main(args);
	} main {
		new Main()._main(args);
	} new Main()._main(args) new Main()._main new Main() args String[] args args public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int Y = sc.nextInt();

		int[] ans = null;
		for(int m=0;m<=N;m++) {
			for(int g=0;g<=N-m;g++) {
				int s = N-(m+g);
				if(Y == m*10000 + g*5000 + s*1000) {
					ans = new int[] {m,g,s};
				}
			}
		}

		if (ans == null) {
			out.println("-1 -1 -1");
		} else {
			out.println(ans[0] + " " + ans[1] + " " + ans[2]);
		}

		sc.close();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

} public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int Y = sc.nextInt();

		int[] ans = null;
		for(int m=0;m<=N;m++) {
			for(int g=0;g<=N-m;g++) {
				int s = N-(m+g);
				if(Y == m*10000 + g*5000 + s*1000) {
					ans = new int[] {m,g,s};
				}
			}
		}

		if (ans == null) {
			out.println("-1 -1 -1");
		} else {
			out.println(ans[0] + " " + ans[1] + " " + ans[2]);
		}

		sc.close();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

} Main
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int Y = sc.nextInt();

		int[] ans = null;
		for(int m=0;m<=N;m++) {
			for(int g=0;g<=N-m;g++) {
				int s = N-(m+g);
				if(Y == m*10000 + g*5000 + s*1000) {
					ans = new int[] {m,g,s};
				}
			}
		}

		if (ans == null) {
			out.println("-1 -1 -1");
		} else {
			out.println(ans[0] + " " + ans[1] + " " + ans[2]);
		}

		sc.close();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

}
