import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		int N,Y;
		Scanner scan = new Scanner(System.in);
		N = scan.nextInt();
		Y = scan.nextInt();

		for(int a = 0; a <= N; a++) {
			for(int b = 0; b <= N - a; b++) {
				int c = N - a - b;
				int total = 10000 * a + 5000 * b + 1000 * c;
				if(total == Y) {
					System.out.println(a + " " + b + " " + c);
					System.exit(0);
				}
			}
		}
		System.out.println("-1 -1 -1");
		scan.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		int N,Y;
		Scanner scan = new Scanner(System.in);
		N = scan.nextInt();
		Y = scan.nextInt();

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

		for(int a = 0; a <= N; a++) {
			for(int b = 0; b <= N - a; b++) {
				int c = N - a - b;
				int total = 10000 * a + 5000 * b + 1000 * c;
				if(total == Y) {
					System.out.println(a + " " + b + " " + c);
					System.exit(0);
				}
			}
		}
		System.out.println("-1 -1 -1");
		scan.close();
	} main {
		int N,Y;
		Scanner scan = new Scanner(System.in);
		N = scan.nextInt();
		Y = scan.nextInt();

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

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

		for(int a = 0; a <= N; a++) {
			for(int b = 0; b <= N - a; b++) {
				int c = N - a - b;
				int total = 10000 * a + 5000 * b + 1000 * c;
				if(total == Y) {
					System.out.println(a + " " + b + " " + c);
					System.exit(0);
				}
			}
		}
		System.out.println("-1 -1 -1");
		scan.close();
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		int N,Y;
		Scanner scan = new Scanner(System.in);
		N = scan.nextInt();
		Y = scan.nextInt();

		for(int a = 0; a <= N; a++) {
			for(int b = 0; b <= N - a; b++) {
				int c = N - a - b;
				int total = 10000 * a + 5000 * b + 1000 * c;
				if(total == Y) {
					System.out.println(a + " " + b + " " + c);
					System.exit(0);
				}
			}
		}
		System.out.println("-1 -1 -1");
		scan.close();
	}
}
