import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int y = scn.nextInt();
		boolean flg = false;
		//		int cnt1=0;
		//		int cnt5=0;
		//		int cnt10=0;
		if (y % 1000 == 0) {
			for (int i = 0; i <= n && flg==false; i++) {
				for (int j = 0; j <= n - i; j++) {
					if (i * 10 + j * 5 + (n - i - j) == y / 1000) {
						flg = true;
						System.out.println(i + " " + j + " " + (n - i - j));
						break;
					}
				}
			}
		}
		if (flg == false) {
			System.out.println("-1 -1 -1");
		}
	}

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

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int y = scn.nextInt();
		boolean flg = false;
		//		int cnt1=0;
		//		int cnt5=0;
		//		int cnt10=0;
		if (y % 1000 == 0) {
			for (int i = 0; i <= n && flg==false; i++) {
				for (int j = 0; j <= n - i; j++) {
					if (i * 10 + j * 5 + (n - i - j) == y / 1000) {
						flg = true;
						System.out.println(i + " " + j + " " + (n - i - j));
						break;
					}
				}
			}
		}
		if (flg == false) {
			System.out.println("-1 -1 -1");
		}
	}

} Main public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int y = scn.nextInt();
		boolean flg = false;
		//		int cnt1=0;
		//		int cnt5=0;
		//		int cnt10=0;
		if (y % 1000 == 0) {
			for (int i = 0; i <= n && flg==false; i++) {
				for (int j = 0; j <= n - i; j++) {
					if (i * 10 + j * 5 + (n - i - j) == y / 1000) {
						flg = true;
						System.out.println(i + " " + j + " " + (n - i - j));
						break;
					}
				}
			}
		}
		if (flg == false) {
			System.out.println("-1 -1 -1");
		}
	} main {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int y = scn.nextInt();
		boolean flg = false;
		//		int cnt1=0;
		//		int cnt5=0;
		//		int cnt10=0;
		if (y % 1000 == 0) {
			for (int i = 0; i <= n && flg==false; i++) {
				for (int j = 0; j <= n - i; j++) {
					if (i * 10 + j * 5 + (n - i - j) == y / 1000) {
						flg = true;
						System.out.println(i + " " + j + " " + (n - i - j));
						break;
					}
				}
			}
		}
		if (flg == false) {
			System.out.println("-1 -1 -1");
		}
	} Scanner scn = new Scanner(System.in); scn new Scanner(System.in) int n = scn.nextInt(); n scn.nextInt() scn.nextInt scn int y = scn.nextInt(); y scn.nextInt() scn.nextInt scn boolean flg = false; flg false if (y % 1000 == 0) {
			for (int i = 0; i <= n && flg==false; i++) {
				for (int j = 0; j <= n - i; j++) {
					if (i * 10 + j * 5 + (n - i - j) == y / 1000) {
						flg = true;
						System.out.println(i + " " + j + " " + (n - i - j));
						break;
					}
				}
			}
		} y % 1000 == 0 y % 1000 y 1000 0 {
			for (int i = 0; i <= n && flg==false; i++) {
				for (int j = 0; j <= n - i; j++) {
					if (i * 10 + j * 5 + (n - i - j) == y / 1000) {
						flg = true;
						System.out.println(i + " " + j + " " + (n - i - j));
						break;
					}
				}
			}
		} for (int i = 0; i <= n && flg==false; i++) {
				for (int j = 0; j <= n - i; j++) {
					if (i * 10 + j * 5 + (n - i - j) == y / 1000) {
						flg = true;
						System.out.println(i + " " + j + " " + (n - i - j));
						break;
					}
				}
			} int i = 0; int i = 0; i 0 i <= n && flg==false i <= n i n flg==false flg false i++ i++ i {
				for (int j = 0; j <= n - i; j++) {
					if (i * 10 + j * 5 + (n - i - j) == y / 1000) {
						flg = true;
						System.out.println(i + " " + j + " " + (n - i - j));
						break;
					}
				}
			} {
				for (int j = 0; j <= n - i; j++) {
					if (i * 10 + j * 5 + (n - i - j) == y / 1000) {
						flg = true;
						System.out.println(i + " " + j + " " + (n - i - j));
						break;
					}
				}
			} for (int j = 0; j <= n - i; j++) {
					if (i * 10 + j * 5 + (n - i - j) == y / 1000) {
						flg = true;
						System.out.println(i + " " + j + " " + (n - i - j));
						break;
					}
				} int j = 0; int j = 0; j 0 j <= n - i j n - i n i j++ j++ j {
					if (i * 10 + j * 5 + (n - i - j) == y / 1000) {
						flg = true;
						System.out.println(i + " " + j + " " + (n - i - j));
						break;
					}
				} {
					if (i * 10 + j * 5 + (n - i - j) == y / 1000) {
						flg = true;
						System.out.println(i + " " + j + " " + (n - i - j));
						break;
					}
				} if (i * 10 + j * 5 + (n - i - j) == y / 1000) {
						flg = true;
						System.out.println(i + " " + j + " " + (n - i - j));
						break;
					} i * 10 + j * 5 + (n - i - j) == y / 1000 i * 10 + j * 5 + (n - i - j) i * 10 + j * 5 + (n - i - j) i * 10 i 10 j * 5 j 5 (n - i - j) n - i - j n i j y / 1000 y 1000 {
						flg = true;
						System.out.println(i + " " + j + " " + (n - i - j));
						break;
					} flg = true flg true System.out.println(i + " " + j + " " + (n - i - j)) System.out.println System.out System System.out i + " " + j + " " + (n - i - j) " " j i + " " + j + " " + (n - i - j) i " " j " " (n - i - j) n - i - j n i j break; if (flg == false) {
			System.out.println("-1 -1 -1");
		} flg == false flg false {
			System.out.println("-1 -1 -1");
		} System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int y = scn.nextInt();
		boolean flg = false;
		//		int cnt1=0;
		//		int cnt5=0;
		//		int cnt10=0;
		if (y % 1000 == 0) {
			for (int i = 0; i <= n && flg==false; i++) {
				for (int j = 0; j <= n - i; j++) {
					if (i * 10 + j * 5 + (n - i - j) == y / 1000) {
						flg = true;
						System.out.println(i + " " + j + " " + (n - i - j));
						break;
					}
				}
			}
		}
		if (flg == false) {
			System.out.println("-1 -1 -1");
		}
	}

} public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int y = scn.nextInt();
		boolean flg = false;
		//		int cnt1=0;
		//		int cnt5=0;
		//		int cnt10=0;
		if (y % 1000 == 0) {
			for (int i = 0; i <= n && flg==false; i++) {
				for (int j = 0; j <= n - i; j++) {
					if (i * 10 + j * 5 + (n - i - j) == y / 1000) {
						flg = true;
						System.out.println(i + " " + j + " " + (n - i - j));
						break;
					}
				}
			}
		}
		if (flg == false) {
			System.out.println("-1 -1 -1");
		}
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int y = scn.nextInt();
		boolean flg = false;
		//		int cnt1=0;
		//		int cnt5=0;
		//		int cnt10=0;
		if (y % 1000 == 0) {
			for (int i = 0; i <= n && flg==false; i++) {
				for (int j = 0; j <= n - i; j++) {
					if (i * 10 + j * 5 + (n - i - j) == y / 1000) {
						flg = true;
						System.out.println(i + " " + j + " " + (n - i - j));
						break;
					}
				}
			}
		}
		if (flg == false) {
			System.out.println("-1 -1 -1");
		}
	}

}
