import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		for (int i=0;i<=N&&i*10000<=Y;i++ ) {
			int now = Y -i *10000;
			for (int j=0;j+i<=N &&j*5000<=now;j++) {
				int temp = now -j *5000;
				if (temp %1000==0 &&j+i+temp/1000==N) {
					System.out.println(i+" "+j+" "+temp/1000);
					return ;
				}
			}
		}
		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 N = sc.nextInt();
		int Y = sc.nextInt();
		for (int i=0;i<=N&&i*10000<=Y;i++ ) {
			int now = Y -i *10000;
			for (int j=0;j+i<=N &&j*5000<=now;j++) {
				int temp = now -j *5000;
				if (temp %1000==0 &&j+i+temp/1000==N) {
					System.out.println(i+" "+j+" "+temp/1000);
					return ;
				}
			}
		}
		System.out.println("-1 -1 -1");
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		for (int i=0;i<=N&&i*10000<=Y;i++ ) {
			int now = Y -i *10000;
			for (int j=0;j+i<=N &&j*5000<=now;j++) {
				int temp = now -j *5000;
				if (temp %1000==0 &&j+i+temp/1000==N) {
					System.out.println(i+" "+j+" "+temp/1000);
					return ;
				}
			}
		}
		System.out.println("-1 -1 -1");
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		for (int i=0;i<=N&&i*10000<=Y;i++ ) {
			int now = Y -i *10000;
			for (int j=0;j+i<=N &&j*5000<=now;j++) {
				int temp = now -j *5000;
				if (temp %1000==0 &&j+i+temp/1000==N) {
					System.out.println(i+" "+j+" "+temp/1000);
					return ;
				}
			}
		}
		System.out.println("-1 -1 -1");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int Y = sc.nextInt(); Y sc.nextInt() sc.nextInt sc for (int i=0;i<=N&&i*10000<=Y;i++ ) {
			int now = Y -i *10000;
			for (int j=0;j+i<=N &&j*5000<=now;j++) {
				int temp = now -j *5000;
				if (temp %1000==0 &&j+i+temp/1000==N) {
					System.out.println(i+" "+j+" "+temp/1000);
					return ;
				}
			}
		} int i=0; int i=0; i 0 i<=N&&i*10000<=Y i<=N i N i*10000<=Y i*10000 i 10000 Y i++ i++ i {
			int now = Y -i *10000;
			for (int j=0;j+i<=N &&j*5000<=now;j++) {
				int temp = now -j *5000;
				if (temp %1000==0 &&j+i+temp/1000==N) {
					System.out.println(i+" "+j+" "+temp/1000);
					return ;
				}
			}
		} {
			int now = Y -i *10000;
			for (int j=0;j+i<=N &&j*5000<=now;j++) {
				int temp = now -j *5000;
				if (temp %1000==0 &&j+i+temp/1000==N) {
					System.out.println(i+" "+j+" "+temp/1000);
					return ;
				}
			}
		} int now = Y -i *10000; now Y -i *10000 Y i *10000 i 10000 for (int j=0;j+i<=N &&j*5000<=now;j++) {
				int temp = now -j *5000;
				if (temp %1000==0 &&j+i+temp/1000==N) {
					System.out.println(i+" "+j+" "+temp/1000);
					return ;
				}
			} int j=0; int j=0; j 0 j+i<=N &&j*5000<=now j+i<=N j+i j i N j*5000<=now j*5000 j 5000 now j++ j++ j {
				int temp = now -j *5000;
				if (temp %1000==0 &&j+i+temp/1000==N) {
					System.out.println(i+" "+j+" "+temp/1000);
					return ;
				}
			} {
				int temp = now -j *5000;
				if (temp %1000==0 &&j+i+temp/1000==N) {
					System.out.println(i+" "+j+" "+temp/1000);
					return ;
				}
			} int temp = now -j *5000; temp now -j *5000 now j *5000 j 5000 if (temp %1000==0 &&j+i+temp/1000==N) {
					System.out.println(i+" "+j+" "+temp/1000);
					return ;
				} temp %1000==0 &&j+i+temp/1000==N temp %1000==0 temp %1000 temp 1000 0 j+i+temp/1000==N j+i+temp/1000 j+i+temp/1000 j i temp/1000 temp 1000 N {
					System.out.println(i+" "+j+" "+temp/1000);
					return ;
				} System.out.println(i+" "+j+" "+temp/1000) System.out.println System.out System System.out i+" "+j+" "+temp/1000 " " j i+" "+j+" "+temp/1000 i " " j " " temp/1000 temp 1000 return ; 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 N = sc.nextInt();
		int Y = sc.nextInt();
		for (int i=0;i<=N&&i*10000<=Y;i++ ) {
			int now = Y -i *10000;
			for (int j=0;j+i<=N &&j*5000<=now;j++) {
				int temp = now -j *5000;
				if (temp %1000==0 &&j+i+temp/1000==N) {
					System.out.println(i+" "+j+" "+temp/1000);
					return ;
				}
			}
		}
		System.out.println("-1 -1 -1");
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		for (int i=0;i<=N&&i*10000<=Y;i++ ) {
			int now = Y -i *10000;
			for (int j=0;j+i<=N &&j*5000<=now;j++) {
				int temp = now -j *5000;
				if (temp %1000==0 &&j+i+temp/1000==N) {
					System.out.println(i+" "+j+" "+temp/1000);
					return ;
				}
			}
		}
		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 N = sc.nextInt();
		int Y = sc.nextInt();
		for (int i=0;i<=N&&i*10000<=Y;i++ ) {
			int now = Y -i *10000;
			for (int j=0;j+i<=N &&j*5000<=now;j++) {
				int temp = now -j *5000;
				if (temp %1000==0 &&j+i+temp/1000==N) {
					System.out.println(i+" "+j+" "+temp/1000);
					return ;
				}
			}
		}
		System.out.println("-1 -1 -1");
	}
}