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 res10000 = -1, res5000 = -1, res1000 = -1;
		sc.close();
		for (int a = 0; a <= N; a++) {
			for (int b = 0; b + a <= N; b++) {
				int c = N - a - b;
				int total = 10000*a + 5000*b + 1000*c;
				if (total == y) {
					res10000 = a;
					res5000 = b;
					res1000 = c;
				}
			}
		}
		System.out.println(res10000 + " " + res5000 + " " + res1000);
	}

} 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 res10000 = -1, res5000 = -1, res1000 = -1;
		sc.close();
		for (int a = 0; a <= N; a++) {
			for (int b = 0; b + a <= N; b++) {
				int c = N - a - b;
				int total = 10000*a + 5000*b + 1000*c;
				if (total == y) {
					res10000 = a;
					res5000 = b;
					res1000 = c;
				}
			}
		}
		System.out.println(res10000 + " " + res5000 + " " + res1000);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int y = sc.nextInt();
		int res10000 = -1, res5000 = -1, res1000 = -1;
		sc.close();
		for (int a = 0; a <= N; a++) {
			for (int b = 0; b + a <= N; b++) {
				int c = N - a - b;
				int total = 10000*a + 5000*b + 1000*c;
				if (total == y) {
					res10000 = a;
					res5000 = b;
					res1000 = c;
				}
			}
		}
		System.out.println(res10000 + " " + res5000 + " " + res1000);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int y = sc.nextInt();
		int res10000 = -1, res5000 = -1, res1000 = -1;
		sc.close();
		for (int a = 0; a <= N; a++) {
			for (int b = 0; b + a <= N; b++) {
				int c = N - a - b;
				int total = 10000*a + 5000*b + 1000*c;
				if (total == y) {
					res10000 = a;
					res5000 = b;
					res1000 = c;
				}
			}
		}
		System.out.println(res10000 + " " + res5000 + " " + res1000);
	} 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 res10000 = -1 res10000 -1 1 res5000 = -1 res5000 -1 1 res1000 = -1; res1000 -1 1 sc.close() sc.close sc for (int a = 0; a <= N; a++) {
			for (int b = 0; b + a <= N; b++) {
				int c = N - a - b;
				int total = 10000*a + 5000*b + 1000*c;
				if (total == y) {
					res10000 = a;
					res5000 = b;
					res1000 = c;
				}
			}
		} int a = 0; int a = 0; a 0 a <= N a N a++ a++ a {
			for (int b = 0; b + a <= N; b++) {
				int c = N - a - b;
				int total = 10000*a + 5000*b + 1000*c;
				if (total == y) {
					res10000 = a;
					res5000 = b;
					res1000 = c;
				}
			}
		} {
			for (int b = 0; b + a <= N; b++) {
				int c = N - a - b;
				int total = 10000*a + 5000*b + 1000*c;
				if (total == y) {
					res10000 = a;
					res5000 = b;
					res1000 = c;
				}
			}
		} for (int b = 0; b + a <= N; b++) {
				int c = N - a - b;
				int total = 10000*a + 5000*b + 1000*c;
				if (total == y) {
					res10000 = a;
					res5000 = b;
					res1000 = c;
				}
			} int b = 0; int b = 0; b 0 b + a <= N b + a b a N b++ b++ b {
				int c = N - a - b;
				int total = 10000*a + 5000*b + 1000*c;
				if (total == y) {
					res10000 = a;
					res5000 = b;
					res1000 = c;
				}
			} {
				int c = N - a - b;
				int total = 10000*a + 5000*b + 1000*c;
				if (total == y) {
					res10000 = a;
					res5000 = b;
					res1000 = c;
				}
			} int c = N - a - b; c N - a - b N - a - b N a b int total = 10000*a + 5000*b + 1000*c; total 10000*a + 5000*b + 1000*c 10000*a + 5000*b + 1000*c 10000*a 10000 a 5000*b 5000 b 1000*c 1000 c if (total == y) {
					res10000 = a;
					res5000 = b;
					res1000 = c;
				} total == y total y {
					res10000 = a;
					res5000 = b;
					res1000 = c;
				} res10000 = a res10000 a res5000 = b res5000 b res1000 = c res1000 c System.out.println(res10000 + " " + res5000 + " " + res1000) System.out.println System.out System System.out res10000 + " " + res5000 + " " + res1000 " " res5000 res10000 + " " + res5000 + " " + res1000 res10000 " " res5000 " " res1000 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 res10000 = -1, res5000 = -1, res1000 = -1;
		sc.close();
		for (int a = 0; a <= N; a++) {
			for (int b = 0; b + a <= N; b++) {
				int c = N - a - b;
				int total = 10000*a + 5000*b + 1000*c;
				if (total == y) {
					res10000 = a;
					res5000 = b;
					res1000 = c;
				}
			}
		}
		System.out.println(res10000 + " " + res5000 + " " + res1000);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int y = sc.nextInt();
		int res10000 = -1, res5000 = -1, res1000 = -1;
		sc.close();
		for (int a = 0; a <= N; a++) {
			for (int b = 0; b + a <= N; b++) {
				int c = N - a - b;
				int total = 10000*a + 5000*b + 1000*c;
				if (total == y) {
					res10000 = a;
					res5000 = b;
					res1000 = c;
				}
			}
		}
		System.out.println(res10000 + " " + res5000 + " " + res1000);
	}

} 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 res10000 = -1, res5000 = -1, res1000 = -1;
		sc.close();
		for (int a = 0; a <= N; a++) {
			for (int b = 0; b + a <= N; b++) {
				int c = N - a - b;
				int total = 10000*a + 5000*b + 1000*c;
				if (total == y) {
					res10000 = a;
					res5000 = b;
					res1000 = c;
				}
			}
		}
		System.out.println(res10000 + " " + res5000 + " " + res1000);
	}

}
