import java.io.PrintWriter;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = Integer.parseInt(sc.next());
		int Y = Integer.parseInt(sc.next());

		out.println(otoshidama(N, Y));
		out.flush();
	}
	
	public static String otoshidama(int N, int Y) {
		int a = N;
		for (int b = 0; b <= N; b++) {
			for (int c = 0; c <= N-b; c++) {
				int total = 10000*(a-b-c)+5000*b+1000*c;
				if (total == Y) {
					return String.format("%d %d %d", (a-b-c), b, c);
				}
			}
		}
		return "-1 -1 -1";
	}
} import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = Integer.parseInt(sc.next());
		int Y = Integer.parseInt(sc.next());

		out.println(otoshidama(N, Y));
		out.flush();
	}
	
	public static String otoshidama(int N, int Y) {
		int a = N;
		for (int b = 0; b <= N; b++) {
			for (int c = 0; c <= N-b; c++) {
				int total = 10000*(a-b-c)+5000*b+1000*c;
				if (total == Y) {
					return String.format("%d %d %d", (a-b-c), b, c);
				}
			}
		}
		return "-1 -1 -1";
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = Integer.parseInt(sc.next());
		int Y = Integer.parseInt(sc.next());

		out.println(otoshidama(N, Y));
		out.flush();
	} main {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = Integer.parseInt(sc.next());
		int Y = Integer.parseInt(sc.next());

		out.println(otoshidama(N, Y));
		out.flush();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int Y = Integer.parseInt(sc.next()); Y Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc out.println(otoshidama(N, Y)) out.println out otoshidama(N, Y) otoshidama N Y out.flush() out.flush out String[] args args public static String otoshidama(int N, int Y) {
		int a = N;
		for (int b = 0; b <= N; b++) {
			for (int c = 0; c <= N-b; c++) {
				int total = 10000*(a-b-c)+5000*b+1000*c;
				if (total == Y) {
					return String.format("%d %d %d", (a-b-c), b, c);
				}
			}
		}
		return "-1 -1 -1";
	} otoshidama {
		int a = N;
		for (int b = 0; b <= N; b++) {
			for (int c = 0; c <= N-b; c++) {
				int total = 10000*(a-b-c)+5000*b+1000*c;
				if (total == Y) {
					return String.format("%d %d %d", (a-b-c), b, c);
				}
			}
		}
		return "-1 -1 -1";
	} int a = N; a N for (int b = 0; b <= N; b++) {
			for (int c = 0; c <= N-b; c++) {
				int total = 10000*(a-b-c)+5000*b+1000*c;
				if (total == Y) {
					return String.format("%d %d %d", (a-b-c), b, c);
				}
			}
		} int b = 0; int b = 0; b 0 b <= N b N b++ b++ b {
			for (int c = 0; c <= N-b; c++) {
				int total = 10000*(a-b-c)+5000*b+1000*c;
				if (total == Y) {
					return String.format("%d %d %d", (a-b-c), b, c);
				}
			}
		} {
			for (int c = 0; c <= N-b; c++) {
				int total = 10000*(a-b-c)+5000*b+1000*c;
				if (total == Y) {
					return String.format("%d %d %d", (a-b-c), b, c);
				}
			}
		} for (int c = 0; c <= N-b; c++) {
				int total = 10000*(a-b-c)+5000*b+1000*c;
				if (total == Y) {
					return String.format("%d %d %d", (a-b-c), b, c);
				}
			} int c = 0; int c = 0; c 0 c <= N-b c N-b N b c++ c++ c {
				int total = 10000*(a-b-c)+5000*b+1000*c;
				if (total == Y) {
					return String.format("%d %d %d", (a-b-c), b, c);
				}
			} {
				int total = 10000*(a-b-c)+5000*b+1000*c;
				if (total == Y) {
					return String.format("%d %d %d", (a-b-c), b, c);
				}
			} int total = 10000*(a-b-c)+5000*b+1000*c; total 10000*(a-b-c)+5000*b+1000*c 10000*(a-b-c)+5000*b+1000*c 10000*(a-b-c) 10000 (a-b-c) a-b-c a b c 5000*b 5000 b 1000*c 1000 c if (total == Y) {
					return String.format("%d %d %d", (a-b-c), b, c);
				} total == Y total Y {
					return String.format("%d %d %d", (a-b-c), b, c);
				} return String.format("%d %d %d", (a-b-c), b, c); String.format("%d %d %d", (a-b-c), b, c) String.format String "%d %d %d" (a-b-c) a-b-c a b c b c return "-1 -1 -1"; "-1 -1 -1" int N N int Y Y public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = Integer.parseInt(sc.next());
		int Y = Integer.parseInt(sc.next());

		out.println(otoshidama(N, Y));
		out.flush();
	}
	
	public static String otoshidama(int N, int Y) {
		int a = N;
		for (int b = 0; b <= N; b++) {
			for (int c = 0; c <= N-b; c++) {
				int total = 10000*(a-b-c)+5000*b+1000*c;
				if (total == Y) {
					return String.format("%d %d %d", (a-b-c), b, c);
				}
			}
		}
		return "-1 -1 -1";
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = Integer.parseInt(sc.next());
		int Y = Integer.parseInt(sc.next());

		out.println(otoshidama(N, Y));
		out.flush();
	}
	
	public static String otoshidama(int N, int Y) {
		int a = N;
		for (int b = 0; b <= N; b++) {
			for (int c = 0; c <= N-b; c++) {
				int total = 10000*(a-b-c)+5000*b+1000*c;
				if (total == Y) {
					return String.format("%d %d %d", (a-b-c), b, c);
				}
			}
		}
		return "-1 -1 -1";
	}
} Main
import java.io.PrintWriter;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = Integer.parseInt(sc.next());
		int Y = Integer.parseInt(sc.next());

		out.println(otoshidama(N, Y));
		out.flush();
	}
	
	public static String otoshidama(int N, int Y) {
		int a = N;
		for (int b = 0; b <= N; b++) {
			for (int c = 0; c <= N-b; c++) {
				int total = 10000*(a-b-c)+5000*b+1000*c;
				if (total == Y) {
					return String.format("%d %d %d", (a-b-c), b, c);
				}
			}
		}
		return "-1 -1 -1";
	}
}