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++){
			for (int j = 0; j+i <= N; j++){
				for (int k = N-i-j; k+i+j <= N; k++){
					if (((i*1000)+(j*5000)+(k*10000)) == Y && (i+j+k) == N){
						System.out.println(k+" "+j+" "+i);
						sc.close();
						return;
					}
				}
			}
		}

		System.out.println("-1 -1 -1");
		sc.close();
	}
} 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++){
			for (int j = 0; j+i <= N; j++){
				for (int k = N-i-j; k+i+j <= N; k++){
					if (((i*1000)+(j*5000)+(k*10000)) == Y && (i+j+k) == N){
						System.out.println(k+" "+j+" "+i);
						sc.close();
						return;
					}
				}
			}
		}

		System.out.println("-1 -1 -1");
		sc.close();
	}
} 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++){
			for (int j = 0; j+i <= N; j++){
				for (int k = N-i-j; k+i+j <= N; k++){
					if (((i*1000)+(j*5000)+(k*10000)) == Y && (i+j+k) == N){
						System.out.println(k+" "+j+" "+i);
						sc.close();
						return;
					}
				}
			}
		}

		System.out.println("-1 -1 -1");
		sc.close();
	} main {
		Scanner sc = new Scanner((System.in));
		int N = sc.nextInt();
		int Y = sc.nextInt();

		for (int i = 0; i <= N; i++){
			for (int j = 0; j+i <= N; j++){
				for (int k = N-i-j; k+i+j <= N; k++){
					if (((i*1000)+(j*5000)+(k*10000)) == Y && (i+j+k) == N){
						System.out.println(k+" "+j+" "+i);
						sc.close();
						return;
					}
				}
			}
		}

		System.out.println("-1 -1 -1");
		sc.close();
	} 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++){
			for (int j = 0; j+i <= N; j++){
				for (int k = N-i-j; k+i+j <= N; k++){
					if (((i*1000)+(j*5000)+(k*10000)) == Y && (i+j+k) == N){
						System.out.println(k+" "+j+" "+i);
						sc.close();
						return;
					}
				}
			}
		} int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
			for (int j = 0; j+i <= N; j++){
				for (int k = N-i-j; k+i+j <= N; k++){
					if (((i*1000)+(j*5000)+(k*10000)) == Y && (i+j+k) == N){
						System.out.println(k+" "+j+" "+i);
						sc.close();
						return;
					}
				}
			}
		} {
			for (int j = 0; j+i <= N; j++){
				for (int k = N-i-j; k+i+j <= N; k++){
					if (((i*1000)+(j*5000)+(k*10000)) == Y && (i+j+k) == N){
						System.out.println(k+" "+j+" "+i);
						sc.close();
						return;
					}
				}
			}
		} for (int j = 0; j+i <= N; j++){
				for (int k = N-i-j; k+i+j <= N; k++){
					if (((i*1000)+(j*5000)+(k*10000)) == Y && (i+j+k) == N){
						System.out.println(k+" "+j+" "+i);
						sc.close();
						return;
					}
				}
			} int j = 0; int j = 0; j 0 j+i <= N j+i j i N j++ j++ j {
				for (int k = N-i-j; k+i+j <= N; k++){
					if (((i*1000)+(j*5000)+(k*10000)) == Y && (i+j+k) == N){
						System.out.println(k+" "+j+" "+i);
						sc.close();
						return;
					}
				}
			} {
				for (int k = N-i-j; k+i+j <= N; k++){
					if (((i*1000)+(j*5000)+(k*10000)) == Y && (i+j+k) == N){
						System.out.println(k+" "+j+" "+i);
						sc.close();
						return;
					}
				}
			} for (int k = N-i-j; k+i+j <= N; k++){
					if (((i*1000)+(j*5000)+(k*10000)) == Y && (i+j+k) == N){
						System.out.println(k+" "+j+" "+i);
						sc.close();
						return;
					}
				} int k = N-i-j; int k = N-i-j; k N-i-j N-i-j N i j k+i+j <= N k+i+j k+i+j k i j N k++ k++ k {
					if (((i*1000)+(j*5000)+(k*10000)) == Y && (i+j+k) == N){
						System.out.println(k+" "+j+" "+i);
						sc.close();
						return;
					}
				} {
					if (((i*1000)+(j*5000)+(k*10000)) == Y && (i+j+k) == N){
						System.out.println(k+" "+j+" "+i);
						sc.close();
						return;
					}
				} if (((i*1000)+(j*5000)+(k*10000)) == Y && (i+j+k) == N){
						System.out.println(k+" "+j+" "+i);
						sc.close();
						return;
					} ((i*1000)+(j*5000)+(k*10000)) == Y && (i+j+k) == N ((i*1000)+(j*5000)+(k*10000)) == Y ((i*1000)+(j*5000)+(k*10000)) (i*1000)+(j*5000)+(k*10000) (i*1000) i 1000 (j*5000) j 5000 (k*10000) k 10000 Y (i+j+k) == N (i+j+k) i+j+k i j k N {
						System.out.println(k+" "+j+" "+i);
						sc.close();
						return;
					} System.out.println(k+" "+j+" "+i) System.out.println System.out System System.out k+" "+j+" "+i " " j k+" "+j+" "+i k " " j " " i sc.close() sc.close sc return; System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" sc.close() sc.close sc 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++){
			for (int j = 0; j+i <= N; j++){
				for (int k = N-i-j; k+i+j <= N; k++){
					if (((i*1000)+(j*5000)+(k*10000)) == Y && (i+j+k) == N){
						System.out.println(k+" "+j+" "+i);
						sc.close();
						return;
					}
				}
			}
		}

		System.out.println("-1 -1 -1");
		sc.close();
	}
} 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++){
			for (int j = 0; j+i <= N; j++){
				for (int k = N-i-j; k+i+j <= N; k++){
					if (((i*1000)+(j*5000)+(k*10000)) == Y && (i+j+k) == N){
						System.out.println(k+" "+j+" "+i);
						sc.close();
						return;
					}
				}
			}
		}

		System.out.println("-1 -1 -1");
		sc.close();
	}
} 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++){
			for (int j = 0; j+i <= N; j++){
				for (int k = N-i-j; k+i+j <= N; k++){
					if (((i*1000)+(j*5000)+(k*10000)) == Y && (i+j+k) == N){
						System.out.println(k+" "+j+" "+i);
						sc.close();
						return;
					}
				}
			}
		}

		System.out.println("-1 -1 -1");
		sc.close();
	}
}
