import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
 
		int i = 0;
		int j = 0;
		int k = 0;
		int N = sc.nextInt();
		int Y = sc.nextInt();
		boolean result = false;
 
		loop: for (i = 0; i <= N; i++) {
			for (j = 0; j <= N - i; j++) {
				k = N - i - j;
				if (Y == 10000 * i + 5000 * j + 1000 * k) {
					result = true;
					break loop;
				}
			}
		}
 
		if (result) {
			System.out.println(i + " " + j + " " + k);
		} else {
			System.out.println("-1 -1 -1");
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
 
		int i = 0;
		int j = 0;
		int k = 0;
		int N = sc.nextInt();
		int Y = sc.nextInt();
		boolean result = false;
 
		loop: for (i = 0; i <= N; i++) {
			for (j = 0; j <= N - i; j++) {
				k = N - i - j;
				if (Y == 10000 * i + 5000 * j + 1000 * k) {
					result = true;
					break loop;
				}
			}
		}
 
		if (result) {
			System.out.println(i + " " + j + " " + k);
		} else {
			System.out.println("-1 -1 -1");
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
 
		int i = 0;
		int j = 0;
		int k = 0;
		int N = sc.nextInt();
		int Y = sc.nextInt();
		boolean result = false;
 
		loop: for (i = 0; i <= N; i++) {
			for (j = 0; j <= N - i; j++) {
				k = N - i - j;
				if (Y == 10000 * i + 5000 * j + 1000 * k) {
					result = true;
					break loop;
				}
			}
		}
 
		if (result) {
			System.out.println(i + " " + j + " " + k);
		} else {
			System.out.println("-1 -1 -1");
		}
	} main {
		Scanner sc = new Scanner(System.in);
 
		int i = 0;
		int j = 0;
		int k = 0;
		int N = sc.nextInt();
		int Y = sc.nextInt();
		boolean result = false;
 
		loop: for (i = 0; i <= N; i++) {
			for (j = 0; j <= N - i; j++) {
				k = N - i - j;
				if (Y == 10000 * i + 5000 * j + 1000 * k) {
					result = true;
					break loop;
				}
			}
		}
 
		if (result) {
			System.out.println(i + " " + j + " " + k);
		} else {
			System.out.println("-1 -1 -1");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int i = 0; i 0 int j = 0; j 0 int k = 0; k 0 int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int Y = sc.nextInt(); Y sc.nextInt() sc.nextInt sc boolean result = false; result false if (result) {
			System.out.println(i + " " + j + " " + k);
		} else {
			System.out.println("-1 -1 -1");
		} result {
			System.out.println(i + " " + j + " " + k);
		} System.out.println(i + " " + j + " " + k) System.out.println System.out System System.out i + " " + j + " " + k " " j i + " " + j + " " + k i " " j " " k {
			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 sc = new Scanner(System.in);
 
		int i = 0;
		int j = 0;
		int k = 0;
		int N = sc.nextInt();
		int Y = sc.nextInt();
		boolean result = false;
 
		loop: for (i = 0; i <= N; i++) {
			for (j = 0; j <= N - i; j++) {
				k = N - i - j;
				if (Y == 10000 * i + 5000 * j + 1000 * k) {
					result = true;
					break loop;
				}
			}
		}
 
		if (result) {
			System.out.println(i + " " + j + " " + k);
		} else {
			System.out.println("-1 -1 -1");
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
 
		int i = 0;
		int j = 0;
		int k = 0;
		int N = sc.nextInt();
		int Y = sc.nextInt();
		boolean result = false;
 
		loop: for (i = 0; i <= N; i++) {
			for (j = 0; j <= N - i; j++) {
				k = N - i - j;
				if (Y == 10000 * i + 5000 * j + 1000 * k) {
					result = true;
					break loop;
				}
			}
		}
 
		if (result) {
			System.out.println(i + " " + j + " " + k);
		} else {
			System.out.println("-1 -1 -1");
		}
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
 
		int i = 0;
		int j = 0;
		int k = 0;
		int N = sc.nextInt();
		int Y = sc.nextInt();
		boolean result = false;
 
		loop: for (i = 0; i <= N; i++) {
			for (j = 0; j <= N - i; j++) {
				k = N - i - j;
				if (Y == 10000 * i + 5000 * j + 1000 * k) {
					result = true;
					break loop;
				}
			}
		}
 
		if (result) {
			System.out.println(i + " " + j + " " + k);
		} else {
			System.out.println("-1 -1 -1");
		}
	}
}