import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		try {
			int correctNum = scanner.nextInt();
			int correctYen = scanner.nextInt();

			for (int x = correctNum; x >= 0; x--) {
				if (calc(x,0,0)> correctYen) {
					continue;
				}
				for (int y = 0; y <= correctNum - x; y++) {
					int z = correctNum - (x + y);
					int sumYen = 10000 * x + 5000 * y + 1000 * z;
					if (sumYen == correctYen) {
							System.out.print(String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z));
							return;
					}
				}
			}
			System.out.print("-1 -1 -1");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			scanner.close();
		}
	}

	private static int calc(int x, int y, int z) {
		return 10000 * x + 5000 * y + 1000 * z;
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		try {
			int correctNum = scanner.nextInt();
			int correctYen = scanner.nextInt();

			for (int x = correctNum; x >= 0; x--) {
				if (calc(x,0,0)> correctYen) {
					continue;
				}
				for (int y = 0; y <= correctNum - x; y++) {
					int z = correctNum - (x + y);
					int sumYen = 10000 * x + 5000 * y + 1000 * z;
					if (sumYen == correctYen) {
							System.out.print(String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z));
							return;
					}
				}
			}
			System.out.print("-1 -1 -1");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			scanner.close();
		}
	}

	private static int calc(int x, int y, int z) {
		return 10000 * x + 5000 * y + 1000 * z;
	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		try {
			int correctNum = scanner.nextInt();
			int correctYen = scanner.nextInt();

			for (int x = correctNum; x >= 0; x--) {
				if (calc(x,0,0)> correctYen) {
					continue;
				}
				for (int y = 0; y <= correctNum - x; y++) {
					int z = correctNum - (x + y);
					int sumYen = 10000 * x + 5000 * y + 1000 * z;
					if (sumYen == correctYen) {
							System.out.print(String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z));
							return;
					}
				}
			}
			System.out.print("-1 -1 -1");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			scanner.close();
		}
	} main {
		Scanner scanner = new Scanner(System.in);
		try {
			int correctNum = scanner.nextInt();
			int correctYen = scanner.nextInt();

			for (int x = correctNum; x >= 0; x--) {
				if (calc(x,0,0)> correctYen) {
					continue;
				}
				for (int y = 0; y <= correctNum - x; y++) {
					int z = correctNum - (x + y);
					int sumYen = 10000 * x + 5000 * y + 1000 * z;
					if (sumYen == correctYen) {
							System.out.print(String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z));
							return;
					}
				}
			}
			System.out.print("-1 -1 -1");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			scanner.close();
		}
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) try {
			int correctNum = scanner.nextInt();
			int correctYen = scanner.nextInt();

			for (int x = correctNum; x >= 0; x--) {
				if (calc(x,0,0)> correctYen) {
					continue;
				}
				for (int y = 0; y <= correctNum - x; y++) {
					int z = correctNum - (x + y);
					int sumYen = 10000 * x + 5000 * y + 1000 * z;
					if (sumYen == correctYen) {
							System.out.print(String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z));
							return;
					}
				}
			}
			System.out.print("-1 -1 -1");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			scanner.close();
		} catch (Exception e) {
			e.printStackTrace();
		} Exception e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			scanner.close();
		} scanner.close() scanner.close scanner {
			int correctNum = scanner.nextInt();
			int correctYen = scanner.nextInt();

			for (int x = correctNum; x >= 0; x--) {
				if (calc(x,0,0)> correctYen) {
					continue;
				}
				for (int y = 0; y <= correctNum - x; y++) {
					int z = correctNum - (x + y);
					int sumYen = 10000 * x + 5000 * y + 1000 * z;
					if (sumYen == correctYen) {
							System.out.print(String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z));
							return;
					}
				}
			}
			System.out.print("-1 -1 -1");
		} int correctNum = scanner.nextInt(); correctNum scanner.nextInt() scanner.nextInt scanner int correctYen = scanner.nextInt(); correctYen scanner.nextInt() scanner.nextInt scanner for (int x = correctNum; x >= 0; x--) {
				if (calc(x,0,0)> correctYen) {
					continue;
				}
				for (int y = 0; y <= correctNum - x; y++) {
					int z = correctNum - (x + y);
					int sumYen = 10000 * x + 5000 * y + 1000 * z;
					if (sumYen == correctYen) {
							System.out.print(String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z));
							return;
					}
				}
			} int x = correctNum; int x = correctNum; x correctNum x >= 0 x 0 x-- x-- x {
				if (calc(x,0,0)> correctYen) {
					continue;
				}
				for (int y = 0; y <= correctNum - x; y++) {
					int z = correctNum - (x + y);
					int sumYen = 10000 * x + 5000 * y + 1000 * z;
					if (sumYen == correctYen) {
							System.out.print(String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z));
							return;
					}
				}
			} {
				if (calc(x,0,0)> correctYen) {
					continue;
				}
				for (int y = 0; y <= correctNum - x; y++) {
					int z = correctNum - (x + y);
					int sumYen = 10000 * x + 5000 * y + 1000 * z;
					if (sumYen == correctYen) {
							System.out.print(String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z));
							return;
					}
				}
			} if (calc(x,0,0)> correctYen) {
					continue;
				} calc(x,0,0)> correctYen calc(x,0,0) calc x 0 0 correctYen {
					continue;
				} continue; for (int y = 0; y <= correctNum - x; y++) {
					int z = correctNum - (x + y);
					int sumYen = 10000 * x + 5000 * y + 1000 * z;
					if (sumYen == correctYen) {
							System.out.print(String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z));
							return;
					}
				} int y = 0; int y = 0; y 0 y <= correctNum - x y correctNum - x correctNum x y++ y++ y {
					int z = correctNum - (x + y);
					int sumYen = 10000 * x + 5000 * y + 1000 * z;
					if (sumYen == correctYen) {
							System.out.print(String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z));
							return;
					}
				} {
					int z = correctNum - (x + y);
					int sumYen = 10000 * x + 5000 * y + 1000 * z;
					if (sumYen == correctYen) {
							System.out.print(String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z));
							return;
					}
				} int z = correctNum - (x + y); z correctNum - (x + y) correctNum (x + y) x y int sumYen = 10000 * x + 5000 * y + 1000 * z; sumYen 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 (sumYen == correctYen) {
							System.out.print(String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z));
							return;
					} sumYen == correctYen sumYen correctYen {
							System.out.print(String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z));
							return;
					} System.out.print(String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z)) System.out.print System.out System System.out String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z) " " String.valueOf(y) String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z) String.valueOf(x) String.valueOf String x " " String.valueOf(y) String.valueOf String y " " String.valueOf(z) String.valueOf String z return; System.out.print("-1 -1 -1") System.out.print System.out System System.out "-1 -1 -1" String[] args args private static int calc(int x, int y, int z) {
		return 10000 * x + 5000 * y + 1000 * z;
	} calc {
		return 10000 * x + 5000 * y + 1000 * z;
	} return 10000 * x + 5000 * y + 1000 * z; 10000 * x + 5000 * y + 1000 * z 10000 * x + 5000 * y + 1000 * z 10000 * x 10000 x 5000 * y 5000 y 1000 * z 1000 z int x x int y y int z z public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		try {
			int correctNum = scanner.nextInt();
			int correctYen = scanner.nextInt();

			for (int x = correctNum; x >= 0; x--) {
				if (calc(x,0,0)> correctYen) {
					continue;
				}
				for (int y = 0; y <= correctNum - x; y++) {
					int z = correctNum - (x + y);
					int sumYen = 10000 * x + 5000 * y + 1000 * z;
					if (sumYen == correctYen) {
							System.out.print(String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z));
							return;
					}
				}
			}
			System.out.print("-1 -1 -1");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			scanner.close();
		}
	}

	private static int calc(int x, int y, int z) {
		return 10000 * x + 5000 * y + 1000 * z;
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		try {
			int correctNum = scanner.nextInt();
			int correctYen = scanner.nextInt();

			for (int x = correctNum; x >= 0; x--) {
				if (calc(x,0,0)> correctYen) {
					continue;
				}
				for (int y = 0; y <= correctNum - x; y++) {
					int z = correctNum - (x + y);
					int sumYen = 10000 * x + 5000 * y + 1000 * z;
					if (sumYen == correctYen) {
							System.out.print(String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z));
							return;
					}
				}
			}
			System.out.print("-1 -1 -1");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			scanner.close();
		}
	}

	private static int calc(int x, int y, int z) {
		return 10000 * x + 5000 * y + 1000 * z;
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		try {
			int correctNum = scanner.nextInt();
			int correctYen = scanner.nextInt();

			for (int x = correctNum; x >= 0; x--) {
				if (calc(x,0,0)> correctYen) {
					continue;
				}
				for (int y = 0; y <= correctNum - x; y++) {
					int z = correctNum - (x + y);
					int sumYen = 10000 * x + 5000 * y + 1000 * z;
					if (sumYen == correctYen) {
							System.out.print(String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z));
							return;
					}
				}
			}
			System.out.print("-1 -1 -1");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			scanner.close();
		}
	}

	private static int calc(int x, int y, int z) {
		return 10000 * x + 5000 * y + 1000 * z;
	}
}
