import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	private static final boolean TEST = true;

	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n, y;
		n = in.nextInt();
		y = in.nextInt();
		solve(n, y);
		in.close();
	}

	private static void solve(int n, int y) {
		y /= 1000;
		y -= n;
		for (int i = y / 9; i >= 0; i--) {
			int m = y - i * 9;
			if (m / 4 > n - i)
				break;
			if (m % 4 == 0) {
				System.out.println(i + " " + (m / 4) + " " + (n - i - m / 4));
				return;
			}
		}
		System.out.println(-1 + " " + -1 + " " + -1);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util import java.util.PriorityQueue; PriorityQueue java.util import java.util.Scanner; Scanner java.util public class Main {
	private static final boolean TEST = true;

	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n, y;
		n = in.nextInt();
		y = in.nextInt();
		solve(n, y);
		in.close();
	}

	private static void solve(int n, int y) {
		y /= 1000;
		y -= n;
		for (int i = y / 9; i >= 0; i--) {
			int m = y - i * 9;
			if (m / 4 > n - i)
				break;
			if (m % 4 == 0) {
				System.out.println(i + " " + (m / 4) + " " + (n - i - m / 4));
				return;
			}
		}
		System.out.println(-1 + " " + -1 + " " + -1);
	}
} Main private static final boolean TEST = true; TEST true public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n, y;
		n = in.nextInt();
		y = in.nextInt();
		solve(n, y);
		in.close();
	} main {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n, y;
		n = in.nextInt();
		y = in.nextInt();
		solve(n, y);
		in.close();
	} Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); in new Scanner(new BufferedReader(new InputStreamReader(System.in))) int n n y; y n = in.nextInt() n in.nextInt() in.nextInt in y = in.nextInt() y in.nextInt() in.nextInt in solve(n, y) solve n y in.close() in.close in String[] args args private static void solve(int n, int y) {
		y /= 1000;
		y -= n;
		for (int i = y / 9; i >= 0; i--) {
			int m = y - i * 9;
			if (m / 4 > n - i)
				break;
			if (m % 4 == 0) {
				System.out.println(i + " " + (m / 4) + " " + (n - i - m / 4));
				return;
			}
		}
		System.out.println(-1 + " " + -1 + " " + -1);
	} solve {
		y /= 1000;
		y -= n;
		for (int i = y / 9; i >= 0; i--) {
			int m = y - i * 9;
			if (m / 4 > n - i)
				break;
			if (m % 4 == 0) {
				System.out.println(i + " " + (m / 4) + " " + (n - i - m / 4));
				return;
			}
		}
		System.out.println(-1 + " " + -1 + " " + -1);
	} y /= 1000 y 1000 y -= n y n for (int i = y / 9; i >= 0; i--) {
			int m = y - i * 9;
			if (m / 4 > n - i)
				break;
			if (m % 4 == 0) {
				System.out.println(i + " " + (m / 4) + " " + (n - i - m / 4));
				return;
			}
		} int i = y / 9; int i = y / 9; i y / 9 y 9 i >= 0 i 0 i-- i-- i {
			int m = y - i * 9;
			if (m / 4 > n - i)
				break;
			if (m % 4 == 0) {
				System.out.println(i + " " + (m / 4) + " " + (n - i - m / 4));
				return;
			}
		} {
			int m = y - i * 9;
			if (m / 4 > n - i)
				break;
			if (m % 4 == 0) {
				System.out.println(i + " " + (m / 4) + " " + (n - i - m / 4));
				return;
			}
		} int m = y - i * 9; m y - i * 9 y i * 9 i 9 if (m / 4 > n - i)
				break; m / 4 > n - i m / 4 m 4 n - i n i break; if (m % 4 == 0) {
				System.out.println(i + " " + (m / 4) + " " + (n - i - m / 4));
				return;
			} m % 4 == 0 m % 4 m 4 0 {
				System.out.println(i + " " + (m / 4) + " " + (n - i - m / 4));
				return;
			} System.out.println(i + " " + (m / 4) + " " + (n - i - m / 4)) System.out.println System.out System System.out i + " " + (m / 4) + " " + (n - i - m / 4) " " (m / 4) i + " " + (m / 4) + " " + (n - i - m / 4) i " " (m / 4) m 4 " " (n - i - m / 4) n - i - m / 4 n i m / 4 m 4 return; System.out.println(-1 + " " + -1 + " " + -1) System.out.println System.out System System.out -1 + " " + -1 + " " + -1 " " -1 -1 + " " + -1 + " " + -1 -1 1 " " -1 1 " " -1 1 int n n int y y public class Main {
	private static final boolean TEST = true;

	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n, y;
		n = in.nextInt();
		y = in.nextInt();
		solve(n, y);
		in.close();
	}

	private static void solve(int n, int y) {
		y /= 1000;
		y -= n;
		for (int i = y / 9; i >= 0; i--) {
			int m = y - i * 9;
			if (m / 4 > n - i)
				break;
			if (m % 4 == 0) {
				System.out.println(i + " " + (m / 4) + " " + (n - i - m / 4));
				return;
			}
		}
		System.out.println(-1 + " " + -1 + " " + -1);
	}
} public class Main {
	private static final boolean TEST = true;

	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n, y;
		n = in.nextInt();
		y = in.nextInt();
		solve(n, y);
		in.close();
	}

	private static void solve(int n, int y) {
		y /= 1000;
		y -= n;
		for (int i = y / 9; i >= 0; i--) {
			int m = y - i * 9;
			if (m / 4 > n - i)
				break;
			if (m % 4 == 0) {
				System.out.println(i + " " + (m / 4) + " " + (n - i - m / 4));
				return;
			}
		}
		System.out.println(-1 + " " + -1 + " " + -1);
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	private static final boolean TEST = true;

	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n, y;
		n = in.nextInt();
		y = in.nextInt();
		solve(n, y);
		in.close();
	}

	private static void solve(int n, int y) {
		y /= 1000;
		y -= n;
		for (int i = y / 9; i >= 0; i--) {
			int m = y - i * 9;
			if (m / 4 > n - i)
				break;
			if (m % 4 == 0) {
				System.out.println(i + " " + (m / 4) + " " + (n - i - m / 4));
				return;
			}
		}
		System.out.println(-1 + " " + -1 + " " + -1);
	}
}