import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		int n,y;

		n = sc.nextInt();
		y = sc.nextInt();

		int i,j,k;



		for(i = 0; i <= n; i++) {
			for(j = 0; j <= n; j++) {
				for(k = 0 ; k <= n; k++) {

					int total = 10000*i+5000*j+1000*k;
					if(i+j+k > n || total > y) {
						break;
					}

					if(total == y && i+j+k == n) {
						System.out.println(i+" "+j+" "+k);
						return;
					}
				}
			}
		}
		System.out.println("-1 -1 -1");

	}

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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		int n,y;

		n = sc.nextInt();
		y = sc.nextInt();

		int i,j,k;



		for(i = 0; i <= n; i++) {
			for(j = 0; j <= n; j++) {
				for(k = 0 ; k <= n; k++) {

					int total = 10000*i+5000*j+1000*k;
					if(i+j+k > n || total > y) {
						break;
					}

					if(total == y && i+j+k == n) {
						System.out.println(i+" "+j+" "+k);
						return;
					}
				}
			}
		}
		System.out.println("-1 -1 -1");

	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		int n,y;

		n = sc.nextInt();
		y = sc.nextInt();

		int i,j,k;



		for(i = 0; i <= n; i++) {
			for(j = 0; j <= n; j++) {
				for(k = 0 ; k <= n; k++) {

					int total = 10000*i+5000*j+1000*k;
					if(i+j+k > n || total > y) {
						break;
					}

					if(total == y && i+j+k == n) {
						System.out.println(i+" "+j+" "+k);
						return;
					}
				}
			}
		}
		System.out.println("-1 -1 -1");

	} main {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		int n,y;

		n = sc.nextInt();
		y = sc.nextInt();

		int i,j,k;



		for(i = 0; i <= n; i++) {
			for(j = 0; j <= n; j++) {
				for(k = 0 ; k <= n; k++) {

					int total = 10000*i+5000*j+1000*k;
					if(i+j+k > n || total > y) {
						break;
					}

					if(total == y && i+j+k == n) {
						System.out.println(i+" "+j+" "+k);
						return;
					}
				}
			}
		}
		System.out.println("-1 -1 -1");

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n n y; y n = sc.nextInt() n sc.nextInt() sc.nextInt sc y = sc.nextInt() y sc.nextInt() sc.nextInt sc int i i j j k; k for(i = 0; i <= n; i++) {
			for(j = 0; j <= n; j++) {
				for(k = 0 ; k <= n; k++) {

					int total = 10000*i+5000*j+1000*k;
					if(i+j+k > n || total > y) {
						break;
					}

					if(total == y && i+j+k == n) {
						System.out.println(i+" "+j+" "+k);
						return;
					}
				}
			}
		} i = 0; i = 0 i 0 i <= n i n i++ i++ i {
			for(j = 0; j <= n; j++) {
				for(k = 0 ; k <= n; k++) {

					int total = 10000*i+5000*j+1000*k;
					if(i+j+k > n || total > y) {
						break;
					}

					if(total == y && i+j+k == n) {
						System.out.println(i+" "+j+" "+k);
						return;
					}
				}
			}
		} {
			for(j = 0; j <= n; j++) {
				for(k = 0 ; k <= n; k++) {

					int total = 10000*i+5000*j+1000*k;
					if(i+j+k > n || total > y) {
						break;
					}

					if(total == y && i+j+k == n) {
						System.out.println(i+" "+j+" "+k);
						return;
					}
				}
			}
		} for(j = 0; j <= n; j++) {
				for(k = 0 ; k <= n; k++) {

					int total = 10000*i+5000*j+1000*k;
					if(i+j+k > n || total > y) {
						break;
					}

					if(total == y && i+j+k == n) {
						System.out.println(i+" "+j+" "+k);
						return;
					}
				}
			} j = 0; j = 0 j 0 j <= n j n j++ j++ j {
				for(k = 0 ; k <= n; k++) {

					int total = 10000*i+5000*j+1000*k;
					if(i+j+k > n || total > y) {
						break;
					}

					if(total == y && i+j+k == n) {
						System.out.println(i+" "+j+" "+k);
						return;
					}
				}
			} {
				for(k = 0 ; k <= n; k++) {

					int total = 10000*i+5000*j+1000*k;
					if(i+j+k > n || total > y) {
						break;
					}

					if(total == y && i+j+k == n) {
						System.out.println(i+" "+j+" "+k);
						return;
					}
				}
			} for(k = 0 ; k <= n; k++) {

					int total = 10000*i+5000*j+1000*k;
					if(i+j+k > n || total > y) {
						break;
					}

					if(total == y && i+j+k == n) {
						System.out.println(i+" "+j+" "+k);
						return;
					}
				} k = 0 ; k = 0 k 0 k <= n k n k++ k++ k {

					int total = 10000*i+5000*j+1000*k;
					if(i+j+k > n || total > y) {
						break;
					}

					if(total == y && i+j+k == n) {
						System.out.println(i+" "+j+" "+k);
						return;
					}
				} {

					int total = 10000*i+5000*j+1000*k;
					if(i+j+k > n || total > y) {
						break;
					}

					if(total == y && i+j+k == n) {
						System.out.println(i+" "+j+" "+k);
						return;
					}
				} int total = 10000*i+5000*j+1000*k; total 10000*i+5000*j+1000*k 10000*i+5000*j+1000*k 10000*i 10000 i 5000*j 5000 j 1000*k 1000 k if(i+j+k > n || total > y) {
						break;
					} i+j+k > n || total > y i+j+k > n i+j+k i+j+k i j k n total > y total y {
						break;
					} break; if(total == y && i+j+k == n) {
						System.out.println(i+" "+j+" "+k);
						return;
					} total == y && i+j+k == n total == y total y i+j+k == n i+j+k i+j+k i j k n {
						System.out.println(i+" "+j+" "+k);
						return;
					} System.out.println(i+" "+j+" "+k) System.out.println System.out System System.out i+" "+j+" "+k " " j i+" "+j+" "+k i " " j " " k 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) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		int n,y;

		n = sc.nextInt();
		y = sc.nextInt();

		int i,j,k;



		for(i = 0; i <= n; i++) {
			for(j = 0; j <= n; j++) {
				for(k = 0 ; k <= n; k++) {

					int total = 10000*i+5000*j+1000*k;
					if(i+j+k > n || total > y) {
						break;
					}

					if(total == y && i+j+k == n) {
						System.out.println(i+" "+j+" "+k);
						return;
					}
				}
			}
		}
		System.out.println("-1 -1 -1");

	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		int n,y;

		n = sc.nextInt();
		y = sc.nextInt();

		int i,j,k;



		for(i = 0; i <= n; i++) {
			for(j = 0; j <= n; j++) {
				for(k = 0 ; k <= n; k++) {

					int total = 10000*i+5000*j+1000*k;
					if(i+j+k > n || total > y) {
						break;
					}

					if(total == y && i+j+k == n) {
						System.out.println(i+" "+j+" "+k);
						return;
					}
				}
			}
		}
		System.out.println("-1 -1 -1");

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		int n,y;

		n = sc.nextInt();
		y = sc.nextInt();

		int i,j,k;



		for(i = 0; i <= n; i++) {
			for(j = 0; j <= n; j++) {
				for(k = 0 ; k <= n; k++) {

					int total = 10000*i+5000*j+1000*k;
					if(i+j+k > n || total > y) {
						break;
					}

					if(total == y && i+j+k == n) {
						System.out.println(i+" "+j+" "+k);
						return;
					}
				}
			}
		}
		System.out.println("-1 -1 -1");

	}

}
