import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}


	int N;
	int Y;
	public void run() {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		Y = sc.nextInt();
		int a=-1;
		int b=-1;
		int c=-1;
		boolean hit = false;
		for(int i=0; i<=N; i++) {
			for(int j=0; j<=N-i; j++) {
				if(1000*i + 5000*j + 10000*(N-i-j) == Y) {
					a=i;
					b=j;
					c=N-i-j;
					hit = true;
				}
			}
			if(hit)break;
		}
		System.out.println(c+" "+b+ " "+a);
		sc.close();
	}


} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}


	int N;
	int Y;
	public void run() {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		Y = sc.nextInt();
		int a=-1;
		int b=-1;
		int c=-1;
		boolean hit = false;
		for(int i=0; i<=N; i++) {
			for(int j=0; j<=N-i; j++) {
				if(1000*i + 5000*j + 10000*(N-i-j) == Y) {
					a=i;
					b=j;
					c=N-i-j;
					hit = true;
				}
			}
			if(hit)break;
		}
		System.out.println(c+" "+b+ " "+a);
		sc.close();
	}


} Main int N; N int Y; Y public static void main(String[] args) {
		Main main = new Main();
		main.run();
	} main {
		Main main = new Main();
		main.run();
	} Main main = new Main(); main new Main() main.run() main.run main String[] args args public void run() {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		Y = sc.nextInt();
		int a=-1;
		int b=-1;
		int c=-1;
		boolean hit = false;
		for(int i=0; i<=N; i++) {
			for(int j=0; j<=N-i; j++) {
				if(1000*i + 5000*j + 10000*(N-i-j) == Y) {
					a=i;
					b=j;
					c=N-i-j;
					hit = true;
				}
			}
			if(hit)break;
		}
		System.out.println(c+" "+b+ " "+a);
		sc.close();
	} run {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		Y = sc.nextInt();
		int a=-1;
		int b=-1;
		int c=-1;
		boolean hit = false;
		for(int i=0; i<=N; i++) {
			for(int j=0; j<=N-i; j++) {
				if(1000*i + 5000*j + 10000*(N-i-j) == Y) {
					a=i;
					b=j;
					c=N-i-j;
					hit = true;
				}
			}
			if(hit)break;
		}
		System.out.println(c+" "+b+ " "+a);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) N = sc.nextInt() N sc.nextInt() sc.nextInt sc Y = sc.nextInt() Y sc.nextInt() sc.nextInt sc int a=-1; a -1 1 int b=-1; b -1 1 int c=-1; c -1 1 boolean hit = false; hit false for(int i=0; i<=N; i++) {
			for(int j=0; j<=N-i; j++) {
				if(1000*i + 5000*j + 10000*(N-i-j) == Y) {
					a=i;
					b=j;
					c=N-i-j;
					hit = true;
				}
			}
			if(hit)break;
		} int i=0; int i=0; i 0 i<=N i N i++ i++ i {
			for(int j=0; j<=N-i; j++) {
				if(1000*i + 5000*j + 10000*(N-i-j) == Y) {
					a=i;
					b=j;
					c=N-i-j;
					hit = true;
				}
			}
			if(hit)break;
		} {
			for(int j=0; j<=N-i; j++) {
				if(1000*i + 5000*j + 10000*(N-i-j) == Y) {
					a=i;
					b=j;
					c=N-i-j;
					hit = true;
				}
			}
			if(hit)break;
		} for(int j=0; j<=N-i; j++) {
				if(1000*i + 5000*j + 10000*(N-i-j) == Y) {
					a=i;
					b=j;
					c=N-i-j;
					hit = true;
				}
			} int j=0; int j=0; j 0 j<=N-i j N-i N i j++ j++ j {
				if(1000*i + 5000*j + 10000*(N-i-j) == Y) {
					a=i;
					b=j;
					c=N-i-j;
					hit = true;
				}
			} {
				if(1000*i + 5000*j + 10000*(N-i-j) == Y) {
					a=i;
					b=j;
					c=N-i-j;
					hit = true;
				}
			} if(1000*i + 5000*j + 10000*(N-i-j) == Y) {
					a=i;
					b=j;
					c=N-i-j;
					hit = true;
				} 1000*i + 5000*j + 10000*(N-i-j) == Y 1000*i + 5000*j + 10000*(N-i-j) 1000*i + 5000*j + 10000*(N-i-j) 1000*i 1000 i 5000*j 5000 j 10000*(N-i-j) 10000 (N-i-j) N-i-j N i j Y {
					a=i;
					b=j;
					c=N-i-j;
					hit = true;
				} a=i a i b=j b j c=N-i-j c N-i-j N-i-j N i j hit = true hit true if(hit)break; hit break; System.out.println(c+" "+b+ " "+a) System.out.println System.out System System.out c+" "+b+ " "+a " " b c+" "+b+ " "+a c " " b " " a sc.close() sc.close sc public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}


	int N;
	int Y;
	public void run() {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		Y = sc.nextInt();
		int a=-1;
		int b=-1;
		int c=-1;
		boolean hit = false;
		for(int i=0; i<=N; i++) {
			for(int j=0; j<=N-i; j++) {
				if(1000*i + 5000*j + 10000*(N-i-j) == Y) {
					a=i;
					b=j;
					c=N-i-j;
					hit = true;
				}
			}
			if(hit)break;
		}
		System.out.println(c+" "+b+ " "+a);
		sc.close();
	}


} public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}


	int N;
	int Y;
	public void run() {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		Y = sc.nextInt();
		int a=-1;
		int b=-1;
		int c=-1;
		boolean hit = false;
		for(int i=0; i<=N; i++) {
			for(int j=0; j<=N-i; j++) {
				if(1000*i + 5000*j + 10000*(N-i-j) == Y) {
					a=i;
					b=j;
					c=N-i-j;
					hit = true;
				}
			}
			if(hit)break;
		}
		System.out.println(c+" "+b+ " "+a);
		sc.close();
	}


} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}


	int N;
	int Y;
	public void run() {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		Y = sc.nextInt();
		int a=-1;
		int b=-1;
		int c=-1;
		boolean hit = false;
		for(int i=0; i<=N; i++) {
			for(int j=0; j<=N-i; j++) {
				if(1000*i + 5000*j + 10000*(N-i-j) == Y) {
					a=i;
					b=j;
					c=N-i-j;
					hit = true;
				}
			}
			if(hit)break;
		}
		System.out.println(c+" "+b+ " "+a);
		sc.close();
	}


}