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 tenThousand = -1;
		int fiveThousand = -1;
		int oneThousand = -1;
		int sum = 0;

		for (int i = 0; i <= N; i++) {
			for (int j = 0; i + j <= N; j++) {
				for (int k = 0; i + j + k <= N; k++) {
					if (i + j + k == N) {
						sum = 10000 * i + 5000 * j + 1000 * k;
						if (sum == Y) {
							tenThousand = i;
							fiveThousand = j;
							oneThousand = k;
						}
					}
				}
			}
		}
		System.out.println(tenThousand + " " + fiveThousand + " " + oneThousand);
	}
} 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 tenThousand = -1;
		int fiveThousand = -1;
		int oneThousand = -1;
		int sum = 0;

		for (int i = 0; i <= N; i++) {
			for (int j = 0; i + j <= N; j++) {
				for (int k = 0; i + j + k <= N; k++) {
					if (i + j + k == N) {
						sum = 10000 * i + 5000 * j + 1000 * k;
						if (sum == Y) {
							tenThousand = i;
							fiveThousand = j;
							oneThousand = k;
						}
					}
				}
			}
		}
		System.out.println(tenThousand + " " + fiveThousand + " " + oneThousand);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		int tenThousand = -1;
		int fiveThousand = -1;
		int oneThousand = -1;
		int sum = 0;

		for (int i = 0; i <= N; i++) {
			for (int j = 0; i + j <= N; j++) {
				for (int k = 0; i + j + k <= N; k++) {
					if (i + j + k == N) {
						sum = 10000 * i + 5000 * j + 1000 * k;
						if (sum == Y) {
							tenThousand = i;
							fiveThousand = j;
							oneThousand = k;
						}
					}
				}
			}
		}
		System.out.println(tenThousand + " " + fiveThousand + " " + oneThousand);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		int tenThousand = -1;
		int fiveThousand = -1;
		int oneThousand = -1;
		int sum = 0;

		for (int i = 0; i <= N; i++) {
			for (int j = 0; i + j <= N; j++) {
				for (int k = 0; i + j + k <= N; k++) {
					if (i + j + k == N) {
						sum = 10000 * i + 5000 * j + 1000 * k;
						if (sum == Y) {
							tenThousand = i;
							fiveThousand = j;
							oneThousand = k;
						}
					}
				}
			}
		}
		System.out.println(tenThousand + " " + fiveThousand + " " + oneThousand);
	} 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 tenThousand = -1; tenThousand -1 1 int fiveThousand = -1; fiveThousand -1 1 int oneThousand = -1; oneThousand -1 1 int sum = 0; sum 0 for (int i = 0; i <= N; i++) {
			for (int j = 0; i + j <= N; j++) {
				for (int k = 0; i + j + k <= N; k++) {
					if (i + j + k == N) {
						sum = 10000 * i + 5000 * j + 1000 * k;
						if (sum == Y) {
							tenThousand = i;
							fiveThousand = j;
							oneThousand = k;
						}
					}
				}
			}
		} int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
			for (int j = 0; i + j <= N; j++) {
				for (int k = 0; i + j + k <= N; k++) {
					if (i + j + k == N) {
						sum = 10000 * i + 5000 * j + 1000 * k;
						if (sum == Y) {
							tenThousand = i;
							fiveThousand = j;
							oneThousand = k;
						}
					}
				}
			}
		} {
			for (int j = 0; i + j <= N; j++) {
				for (int k = 0; i + j + k <= N; k++) {
					if (i + j + k == N) {
						sum = 10000 * i + 5000 * j + 1000 * k;
						if (sum == Y) {
							tenThousand = i;
							fiveThousand = j;
							oneThousand = k;
						}
					}
				}
			}
		} for (int j = 0; i + j <= N; j++) {
				for (int k = 0; i + j + k <= N; k++) {
					if (i + j + k == N) {
						sum = 10000 * i + 5000 * j + 1000 * k;
						if (sum == Y) {
							tenThousand = i;
							fiveThousand = j;
							oneThousand = k;
						}
					}
				}
			} int j = 0; int j = 0; j 0 i + j <= N i + j i j N j++ j++ j {
				for (int k = 0; i + j + k <= N; k++) {
					if (i + j + k == N) {
						sum = 10000 * i + 5000 * j + 1000 * k;
						if (sum == Y) {
							tenThousand = i;
							fiveThousand = j;
							oneThousand = k;
						}
					}
				}
			} {
				for (int k = 0; i + j + k <= N; k++) {
					if (i + j + k == N) {
						sum = 10000 * i + 5000 * j + 1000 * k;
						if (sum == Y) {
							tenThousand = i;
							fiveThousand = j;
							oneThousand = k;
						}
					}
				}
			} for (int k = 0; i + j + k <= N; k++) {
					if (i + j + k == N) {
						sum = 10000 * i + 5000 * j + 1000 * k;
						if (sum == Y) {
							tenThousand = i;
							fiveThousand = j;
							oneThousand = k;
						}
					}
				} int k = 0; int k = 0; k 0 i + j + k <= N i + j + k i + j + k i j k N k++ k++ k {
					if (i + j + k == N) {
						sum = 10000 * i + 5000 * j + 1000 * k;
						if (sum == Y) {
							tenThousand = i;
							fiveThousand = j;
							oneThousand = k;
						}
					}
				} {
					if (i + j + k == N) {
						sum = 10000 * i + 5000 * j + 1000 * k;
						if (sum == Y) {
							tenThousand = i;
							fiveThousand = j;
							oneThousand = k;
						}
					}
				} if (i + j + k == N) {
						sum = 10000 * i + 5000 * j + 1000 * k;
						if (sum == Y) {
							tenThousand = i;
							fiveThousand = j;
							oneThousand = k;
						}
					} i + j + k == N i + j + k i + j + k i j k N {
						sum = 10000 * i + 5000 * j + 1000 * k;
						if (sum == Y) {
							tenThousand = i;
							fiveThousand = j;
							oneThousand = k;
						}
					} sum = 10000 * i + 5000 * j + 1000 * k sum 10000 * i + 5000 * j + 1000 * k 10000 * i + 5000 * j + 1000 * k 10000 * i 10000 i 5000 * j 5000 j 1000 * k 1000 k if (sum == Y) {
							tenThousand = i;
							fiveThousand = j;
							oneThousand = k;
						} sum == Y sum Y {
							tenThousand = i;
							fiveThousand = j;
							oneThousand = k;
						} tenThousand = i tenThousand i fiveThousand = j fiveThousand j oneThousand = k oneThousand k System.out.println(tenThousand + " " + fiveThousand + " " + oneThousand) System.out.println System.out System System.out tenThousand + " " + fiveThousand + " " + oneThousand " " fiveThousand tenThousand + " " + fiveThousand + " " + oneThousand tenThousand " " fiveThousand " " oneThousand 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 tenThousand = -1;
		int fiveThousand = -1;
		int oneThousand = -1;
		int sum = 0;

		for (int i = 0; i <= N; i++) {
			for (int j = 0; i + j <= N; j++) {
				for (int k = 0; i + j + k <= N; k++) {
					if (i + j + k == N) {
						sum = 10000 * i + 5000 * j + 1000 * k;
						if (sum == Y) {
							tenThousand = i;
							fiveThousand = j;
							oneThousand = k;
						}
					}
				}
			}
		}
		System.out.println(tenThousand + " " + fiveThousand + " " + oneThousand);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		int tenThousand = -1;
		int fiveThousand = -1;
		int oneThousand = -1;
		int sum = 0;

		for (int i = 0; i <= N; i++) {
			for (int j = 0; i + j <= N; j++) {
				for (int k = 0; i + j + k <= N; k++) {
					if (i + j + k == N) {
						sum = 10000 * i + 5000 * j + 1000 * k;
						if (sum == Y) {
							tenThousand = i;
							fiveThousand = j;
							oneThousand = k;
						}
					}
				}
			}
		}
		System.out.println(tenThousand + " " + fiveThousand + " " + oneThousand);
	}
} 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 tenThousand = -1;
		int fiveThousand = -1;
		int oneThousand = -1;
		int sum = 0;

		for (int i = 0; i <= N; i++) {
			for (int j = 0; i + j <= N; j++) {
				for (int k = 0; i + j + k <= N; k++) {
					if (i + j + k == N) {
						sum = 10000 * i + 5000 * j + 1000 * k;
						if (sum == Y) {
							tenThousand = i;
							fiveThousand = j;
							oneThousand = k;
						}
					}
				}
			}
		}
		System.out.println(tenThousand + " " + fiveThousand + " " + oneThousand);
	}
}
