import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int Y = sc.nextInt();
		int yen10000 = -1;
		int yen5000 = -1;
		int yen1000 = -1;

		for(int x = 0; x <= N; x++) {
			for(int y = 0; y <= N; y++) {
				int z = N - x - y;
				if (z >= 0) {
					int total = 10000*x + 5000*y + 1000*z;
					if(total == Y) {
						yen10000 = x;
						yen5000 = y;
						yen1000 = z;
					}
				}

			}
		}

		System.out.print(yen10000 + " ");
		System.out.print(yen5000 + " ");
		System.out.print(yen1000);
	}
} import java.util.Scanner; Scanner 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 yen10000 = -1;
		int yen5000 = -1;
		int yen1000 = -1;

		for(int x = 0; x <= N; x++) {
			for(int y = 0; y <= N; y++) {
				int z = N - x - y;
				if (z >= 0) {
					int total = 10000*x + 5000*y + 1000*z;
					if(total == Y) {
						yen10000 = x;
						yen5000 = y;
						yen1000 = z;
					}
				}

			}
		}

		System.out.print(yen10000 + " ");
		System.out.print(yen5000 + " ");
		System.out.print(yen1000);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int Y = sc.nextInt();
		int yen10000 = -1;
		int yen5000 = -1;
		int yen1000 = -1;

		for(int x = 0; x <= N; x++) {
			for(int y = 0; y <= N; y++) {
				int z = N - x - y;
				if (z >= 0) {
					int total = 10000*x + 5000*y + 1000*z;
					if(total == Y) {
						yen10000 = x;
						yen5000 = y;
						yen1000 = z;
					}
				}

			}
		}

		System.out.print(yen10000 + " ");
		System.out.print(yen5000 + " ");
		System.out.print(yen1000);
	} main {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int Y = sc.nextInt();
		int yen10000 = -1;
		int yen5000 = -1;
		int yen1000 = -1;

		for(int x = 0; x <= N; x++) {
			for(int y = 0; y <= N; y++) {
				int z = N - x - y;
				if (z >= 0) {
					int total = 10000*x + 5000*y + 1000*z;
					if(total == Y) {
						yen10000 = x;
						yen5000 = y;
						yen1000 = z;
					}
				}

			}
		}

		System.out.print(yen10000 + " ");
		System.out.print(yen5000 + " ");
		System.out.print(yen1000);
	} 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 yen10000 = -1; yen10000 -1 1 int yen5000 = -1; yen5000 -1 1 int yen1000 = -1; yen1000 -1 1 for(int x = 0; x <= N; x++) {
			for(int y = 0; y <= N; y++) {
				int z = N - x - y;
				if (z >= 0) {
					int total = 10000*x + 5000*y + 1000*z;
					if(total == Y) {
						yen10000 = x;
						yen5000 = y;
						yen1000 = 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) {
					int total = 10000*x + 5000*y + 1000*z;
					if(total == Y) {
						yen10000 = x;
						yen5000 = y;
						yen1000 = z;
					}
				}

			}
		} {
			for(int y = 0; y <= N; y++) {
				int z = N - x - y;
				if (z >= 0) {
					int total = 10000*x + 5000*y + 1000*z;
					if(total == Y) {
						yen10000 = x;
						yen5000 = y;
						yen1000 = z;
					}
				}

			}
		} for(int y = 0; y <= N; y++) {
				int z = N - x - y;
				if (z >= 0) {
					int total = 10000*x + 5000*y + 1000*z;
					if(total == Y) {
						yen10000 = x;
						yen5000 = y;
						yen1000 = z;
					}
				}

			} int y = 0; int y = 0; y 0 y <= N y N y++ y++ y {
				int z = N - x - y;
				if (z >= 0) {
					int total = 10000*x + 5000*y + 1000*z;
					if(total == Y) {
						yen10000 = x;
						yen5000 = y;
						yen1000 = z;
					}
				}

			} {
				int z = N - x - y;
				if (z >= 0) {
					int total = 10000*x + 5000*y + 1000*z;
					if(total == Y) {
						yen10000 = x;
						yen5000 = y;
						yen1000 = z;
					}
				}

			} int z = N - x - y; z N - x - y N - x - y N x y if (z >= 0) {
					int total = 10000*x + 5000*y + 1000*z;
					if(total == Y) {
						yen10000 = x;
						yen5000 = y;
						yen1000 = z;
					}
				} z >= 0 z 0 {
					int total = 10000*x + 5000*y + 1000*z;
					if(total == Y) {
						yen10000 = x;
						yen5000 = y;
						yen1000 = z;
					}
				} int total = 10000*x + 5000*y + 1000*z; total 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(total == Y) {
						yen10000 = x;
						yen5000 = y;
						yen1000 = z;
					} total == Y total Y {
						yen10000 = x;
						yen5000 = y;
						yen1000 = z;
					} yen10000 = x yen10000 x yen5000 = y yen5000 y yen1000 = z yen1000 z System.out.print(yen10000 + " ") System.out.print System.out System System.out yen10000 + " " yen10000 " " System.out.print(yen5000 + " ") System.out.print System.out System System.out yen5000 + " " yen5000 " " System.out.print(yen1000) System.out.print System.out System System.out yen1000 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 yen10000 = -1;
		int yen5000 = -1;
		int yen1000 = -1;

		for(int x = 0; x <= N; x++) {
			for(int y = 0; y <= N; y++) {
				int z = N - x - y;
				if (z >= 0) {
					int total = 10000*x + 5000*y + 1000*z;
					if(total == Y) {
						yen10000 = x;
						yen5000 = y;
						yen1000 = z;
					}
				}

			}
		}

		System.out.print(yen10000 + " ");
		System.out.print(yen5000 + " ");
		System.out.print(yen1000);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int Y = sc.nextInt();
		int yen10000 = -1;
		int yen5000 = -1;
		int yen1000 = -1;

		for(int x = 0; x <= N; x++) {
			for(int y = 0; y <= N; y++) {
				int z = N - x - y;
				if (z >= 0) {
					int total = 10000*x + 5000*y + 1000*z;
					if(total == Y) {
						yen10000 = x;
						yen5000 = y;
						yen1000 = z;
					}
				}

			}
		}

		System.out.print(yen10000 + " ");
		System.out.print(yen5000 + " ");
		System.out.print(yen1000);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int Y = sc.nextInt();
		int yen10000 = -1;
		int yen5000 = -1;
		int yen1000 = -1;

		for(int x = 0; x <= N; x++) {
			for(int y = 0; y <= N; y++) {
				int z = N - x - y;
				if (z >= 0) {
					int total = 10000*x + 5000*y + 1000*z;
					if(total == Y) {
						yen10000 = x;
						yen5000 = y;
						yen1000 = z;
					}
				}

			}
		}

		System.out.print(yen10000 + " ");
		System.out.print(yen5000 + " ");
		System.out.print(yen1000);
	}
}
