import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int count = Integer.parseInt(scn.next());
		int total = Integer.parseInt(scn.next());
		int nowMoney = 0;
		boolean isSuccess = false;
		int lastNum = 0;
		for (int i = 0; i <= count; i++) {
			for (int j = 0; j <= count; j++) {
				lastNum = count - (i + j);
				nowMoney = i * 10000 + j * 5000 + lastNum * 1000;
				if (isSuccess) {
					break;
				}
				if (nowMoney == total && lastNum >= 0) {
					System.out.println(i + " " + j + " " + lastNum);
					isSuccess = true;
					break;
				}
			}
		}
		if (!isSuccess) {
			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 count = Integer.parseInt(scn.next());
		int total = Integer.parseInt(scn.next());
		int nowMoney = 0;
		boolean isSuccess = false;
		int lastNum = 0;
		for (int i = 0; i <= count; i++) {
			for (int j = 0; j <= count; j++) {
				lastNum = count - (i + j);
				nowMoney = i * 10000 + j * 5000 + lastNum * 1000;
				if (isSuccess) {
					break;
				}
				if (nowMoney == total && lastNum >= 0) {
					System.out.println(i + " " + j + " " + lastNum);
					isSuccess = true;
					break;
				}
			}
		}
		if (!isSuccess) {
			System.out.println("-1 -1 -1");
		}

	}

} Main public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int count = Integer.parseInt(scn.next());
		int total = Integer.parseInt(scn.next());
		int nowMoney = 0;
		boolean isSuccess = false;
		int lastNum = 0;
		for (int i = 0; i <= count; i++) {
			for (int j = 0; j <= count; j++) {
				lastNum = count - (i + j);
				nowMoney = i * 10000 + j * 5000 + lastNum * 1000;
				if (isSuccess) {
					break;
				}
				if (nowMoney == total && lastNum >= 0) {
					System.out.println(i + " " + j + " " + lastNum);
					isSuccess = true;
					break;
				}
			}
		}
		if (!isSuccess) {
			System.out.println("-1 -1 -1");
		}

	} main {
		Scanner scn = new Scanner(System.in);
		int count = Integer.parseInt(scn.next());
		int total = Integer.parseInt(scn.next());
		int nowMoney = 0;
		boolean isSuccess = false;
		int lastNum = 0;
		for (int i = 0; i <= count; i++) {
			for (int j = 0; j <= count; j++) {
				lastNum = count - (i + j);
				nowMoney = i * 10000 + j * 5000 + lastNum * 1000;
				if (isSuccess) {
					break;
				}
				if (nowMoney == total && lastNum >= 0) {
					System.out.println(i + " " + j + " " + lastNum);
					isSuccess = true;
					break;
				}
			}
		}
		if (!isSuccess) {
			System.out.println("-1 -1 -1");
		}

	} Scanner scn = new Scanner(System.in); scn new Scanner(System.in) int count = Integer.parseInt(scn.next()); count Integer.parseInt(scn.next()) Integer.parseInt Integer scn.next() scn.next scn int total = Integer.parseInt(scn.next()); total Integer.parseInt(scn.next()) Integer.parseInt Integer scn.next() scn.next scn int nowMoney = 0; nowMoney 0 boolean isSuccess = false; isSuccess false int lastNum = 0; lastNum 0 for (int i = 0; i <= count; i++) {
			for (int j = 0; j <= count; j++) {
				lastNum = count - (i + j);
				nowMoney = i * 10000 + j * 5000 + lastNum * 1000;
				if (isSuccess) {
					break;
				}
				if (nowMoney == total && lastNum >= 0) {
					System.out.println(i + " " + j + " " + lastNum);
					isSuccess = true;
					break;
				}
			}
		} int i = 0; int i = 0; i 0 i <= count i count i++ i++ i {
			for (int j = 0; j <= count; j++) {
				lastNum = count - (i + j);
				nowMoney = i * 10000 + j * 5000 + lastNum * 1000;
				if (isSuccess) {
					break;
				}
				if (nowMoney == total && lastNum >= 0) {
					System.out.println(i + " " + j + " " + lastNum);
					isSuccess = true;
					break;
				}
			}
		} {
			for (int j = 0; j <= count; j++) {
				lastNum = count - (i + j);
				nowMoney = i * 10000 + j * 5000 + lastNum * 1000;
				if (isSuccess) {
					break;
				}
				if (nowMoney == total && lastNum >= 0) {
					System.out.println(i + " " + j + " " + lastNum);
					isSuccess = true;
					break;
				}
			}
		} for (int j = 0; j <= count; j++) {
				lastNum = count - (i + j);
				nowMoney = i * 10000 + j * 5000 + lastNum * 1000;
				if (isSuccess) {
					break;
				}
				if (nowMoney == total && lastNum >= 0) {
					System.out.println(i + " " + j + " " + lastNum);
					isSuccess = true;
					break;
				}
			} int j = 0; int j = 0; j 0 j <= count j count j++ j++ j {
				lastNum = count - (i + j);
				nowMoney = i * 10000 + j * 5000 + lastNum * 1000;
				if (isSuccess) {
					break;
				}
				if (nowMoney == total && lastNum >= 0) {
					System.out.println(i + " " + j + " " + lastNum);
					isSuccess = true;
					break;
				}
			} {
				lastNum = count - (i + j);
				nowMoney = i * 10000 + j * 5000 + lastNum * 1000;
				if (isSuccess) {
					break;
				}
				if (nowMoney == total && lastNum >= 0) {
					System.out.println(i + " " + j + " " + lastNum);
					isSuccess = true;
					break;
				}
			} lastNum = count - (i + j) lastNum count - (i + j) count (i + j) i j nowMoney = i * 10000 + j * 5000 + lastNum * 1000 nowMoney i * 10000 + j * 5000 + lastNum * 1000 i * 10000 + j * 5000 + lastNum * 1000 i * 10000 i 10000 j * 5000 j 5000 lastNum * 1000 lastNum 1000 if (isSuccess) {
					break;
				} isSuccess {
					break;
				} break; if (nowMoney == total && lastNum >= 0) {
					System.out.println(i + " " + j + " " + lastNum);
					isSuccess = true;
					break;
				} nowMoney == total && lastNum >= 0 nowMoney == total nowMoney total lastNum >= 0 lastNum 0 {
					System.out.println(i + " " + j + " " + lastNum);
					isSuccess = true;
					break;
				} System.out.println(i + " " + j + " " + lastNum) System.out.println System.out System System.out i + " " + j + " " + lastNum " " j i + " " + j + " " + lastNum i " " j " " lastNum isSuccess = true isSuccess true break; if (!isSuccess) {
			System.out.println("-1 -1 -1");
		} !isSuccess isSuccess {
			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 count = Integer.parseInt(scn.next());
		int total = Integer.parseInt(scn.next());
		int nowMoney = 0;
		boolean isSuccess = false;
		int lastNum = 0;
		for (int i = 0; i <= count; i++) {
			for (int j = 0; j <= count; j++) {
				lastNum = count - (i + j);
				nowMoney = i * 10000 + j * 5000 + lastNum * 1000;
				if (isSuccess) {
					break;
				}
				if (nowMoney == total && lastNum >= 0) {
					System.out.println(i + " " + j + " " + lastNum);
					isSuccess = true;
					break;
				}
			}
		}
		if (!isSuccess) {
			System.out.println("-1 -1 -1");
		}

	}

} public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int count = Integer.parseInt(scn.next());
		int total = Integer.parseInt(scn.next());
		int nowMoney = 0;
		boolean isSuccess = false;
		int lastNum = 0;
		for (int i = 0; i <= count; i++) {
			for (int j = 0; j <= count; j++) {
				lastNum = count - (i + j);
				nowMoney = i * 10000 + j * 5000 + lastNum * 1000;
				if (isSuccess) {
					break;
				}
				if (nowMoney == total && lastNum >= 0) {
					System.out.println(i + " " + j + " " + lastNum);
					isSuccess = true;
					break;
				}
			}
		}
		if (!isSuccess) {
			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 count = Integer.parseInt(scn.next());
		int total = Integer.parseInt(scn.next());
		int nowMoney = 0;
		boolean isSuccess = false;
		int lastNum = 0;
		for (int i = 0; i <= count; i++) {
			for (int j = 0; j <= count; j++) {
				lastNum = count - (i + j);
				nowMoney = i * 10000 + j * 5000 + lastNum * 1000;
				if (isSuccess) {
					break;
				}
				if (nowMoney == total && lastNum >= 0) {
					System.out.println(i + " " + j + " " + lastNum);
					isSuccess = true;
					break;
				}
			}
		}
		if (!isSuccess) {
			System.out.println("-1 -1 -1");
		}

	}

}
