import java.util.*;

public class Main {

	public static void main(String[] args) {



		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int Y = scanner.nextInt();


		String a = "-1";
		String b = "-1";
		String c = "-1";


		for(int i = 0; i <= N; i++) {
			for(int j = 0; i + j <= N; j++) {
				int need_c = N - i - j;
				int temporary_result = 10000*i + 5000*j + 1000*need_c;
				if(temporary_result == Y) {
					a = String.valueOf(i);
					b = String.valueOf(j);
					c = String.valueOf(need_c);
					break;
				}
			}
		}

		System.out.println(a + " " + b + " " + c);
	}

} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {



		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int Y = scanner.nextInt();


		String a = "-1";
		String b = "-1";
		String c = "-1";


		for(int i = 0; i <= N; i++) {
			for(int j = 0; i + j <= N; j++) {
				int need_c = N - i - j;
				int temporary_result = 10000*i + 5000*j + 1000*need_c;
				if(temporary_result == Y) {
					a = String.valueOf(i);
					b = String.valueOf(j);
					c = String.valueOf(need_c);
					break;
				}
			}
		}

		System.out.println(a + " " + b + " " + c);
	}

} Main public static void main(String[] args) {



		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int Y = scanner.nextInt();


		String a = "-1";
		String b = "-1";
		String c = "-1";


		for(int i = 0; i <= N; i++) {
			for(int j = 0; i + j <= N; j++) {
				int need_c = N - i - j;
				int temporary_result = 10000*i + 5000*j + 1000*need_c;
				if(temporary_result == Y) {
					a = String.valueOf(i);
					b = String.valueOf(j);
					c = String.valueOf(need_c);
					break;
				}
			}
		}

		System.out.println(a + " " + b + " " + c);
	} main {



		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int Y = scanner.nextInt();


		String a = "-1";
		String b = "-1";
		String c = "-1";


		for(int i = 0; i <= N; i++) {
			for(int j = 0; i + j <= N; j++) {
				int need_c = N - i - j;
				int temporary_result = 10000*i + 5000*j + 1000*need_c;
				if(temporary_result == Y) {
					a = String.valueOf(i);
					b = String.valueOf(j);
					c = String.valueOf(need_c);
					break;
				}
			}
		}

		System.out.println(a + " " + b + " " + c);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int Y = scanner.nextInt(); Y scanner.nextInt() scanner.nextInt scanner String a = "-1"; a "-1" String b = "-1"; b "-1" String c = "-1"; c "-1" for(int i = 0; i <= N; i++) {
			for(int j = 0; i + j <= N; j++) {
				int need_c = N - i - j;
				int temporary_result = 10000*i + 5000*j + 1000*need_c;
				if(temporary_result == Y) {
					a = String.valueOf(i);
					b = String.valueOf(j);
					c = String.valueOf(need_c);
					break;
				}
			}
		} int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
			for(int j = 0; i + j <= N; j++) {
				int need_c = N - i - j;
				int temporary_result = 10000*i + 5000*j + 1000*need_c;
				if(temporary_result == Y) {
					a = String.valueOf(i);
					b = String.valueOf(j);
					c = String.valueOf(need_c);
					break;
				}
			}
		} {
			for(int j = 0; i + j <= N; j++) {
				int need_c = N - i - j;
				int temporary_result = 10000*i + 5000*j + 1000*need_c;
				if(temporary_result == Y) {
					a = String.valueOf(i);
					b = String.valueOf(j);
					c = String.valueOf(need_c);
					break;
				}
			}
		} for(int j = 0; i + j <= N; j++) {
				int need_c = N - i - j;
				int temporary_result = 10000*i + 5000*j + 1000*need_c;
				if(temporary_result == Y) {
					a = String.valueOf(i);
					b = String.valueOf(j);
					c = String.valueOf(need_c);
					break;
				}
			} int j = 0; int j = 0; j 0 i + j <= N i + j i j N j++ j++ j {
				int need_c = N - i - j;
				int temporary_result = 10000*i + 5000*j + 1000*need_c;
				if(temporary_result == Y) {
					a = String.valueOf(i);
					b = String.valueOf(j);
					c = String.valueOf(need_c);
					break;
				}
			} {
				int need_c = N - i - j;
				int temporary_result = 10000*i + 5000*j + 1000*need_c;
				if(temporary_result == Y) {
					a = String.valueOf(i);
					b = String.valueOf(j);
					c = String.valueOf(need_c);
					break;
				}
			} int need_c = N - i - j; need_c N - i - j N - i - j N i j int temporary_result = 10000*i + 5000*j + 1000*need_c; temporary_result 10000*i + 5000*j + 1000*need_c 10000*i + 5000*j + 1000*need_c 10000*i 10000 i 5000*j 5000 j 1000*need_c 1000 need_c if(temporary_result == Y) {
					a = String.valueOf(i);
					b = String.valueOf(j);
					c = String.valueOf(need_c);
					break;
				} temporary_result == Y temporary_result Y {
					a = String.valueOf(i);
					b = String.valueOf(j);
					c = String.valueOf(need_c);
					break;
				} a = String.valueOf(i) a String.valueOf(i) String.valueOf String i b = String.valueOf(j) b String.valueOf(j) String.valueOf String j c = String.valueOf(need_c) c String.valueOf(need_c) String.valueOf String need_c break; System.out.println(a + " " + b + " " + c) System.out.println System.out System System.out a + " " + b + " " + c " " b a + " " + b + " " + c a " " b " " c String[] args args public class Main {

	public static void main(String[] args) {



		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int Y = scanner.nextInt();


		String a = "-1";
		String b = "-1";
		String c = "-1";


		for(int i = 0; i <= N; i++) {
			for(int j = 0; i + j <= N; j++) {
				int need_c = N - i - j;
				int temporary_result = 10000*i + 5000*j + 1000*need_c;
				if(temporary_result == Y) {
					a = String.valueOf(i);
					b = String.valueOf(j);
					c = String.valueOf(need_c);
					break;
				}
			}
		}

		System.out.println(a + " " + b + " " + c);
	}

} public class Main {

	public static void main(String[] args) {



		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int Y = scanner.nextInt();


		String a = "-1";
		String b = "-1";
		String c = "-1";


		for(int i = 0; i <= N; i++) {
			for(int j = 0; i + j <= N; j++) {
				int need_c = N - i - j;
				int temporary_result = 10000*i + 5000*j + 1000*need_c;
				if(temporary_result == Y) {
					a = String.valueOf(i);
					b = String.valueOf(j);
					c = String.valueOf(need_c);
					break;
				}
			}
		}

		System.out.println(a + " " + b + " " + c);
	}

} Main
import java.util.*;

public class Main {

	public static void main(String[] args) {



		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int Y = scanner.nextInt();


		String a = "-1";
		String b = "-1";
		String c = "-1";


		for(int i = 0; i <= N; i++) {
			for(int j = 0; i + j <= N; j++) {
				int need_c = N - i - j;
				int temporary_result = 10000*i + 5000*j + 1000*need_c;
				if(temporary_result == Y) {
					a = String.valueOf(i);
					b = String.valueOf(j);
					c = String.valueOf(need_c);
					break;
				}
			}
		}

		System.out.println(a + " " + b + " " + c);
	}

}
