import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException{
		Otoshidama solver = new Otoshidama();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	}


	static class Otoshidama {

		private int y;
		private int n;

		private Scanner scanner;
		private String output;

		public Otoshidama() {
			scanner = new Scanner(System.in);
		}

		public void readInput() {
			n = Integer.parseInt(scanner.next());
			y = Integer.parseInt(scanner.next());
			return ;
		}

		public void solve() {
			for(int i=0; i<=n;i++) {
				for(int j=0; j<=n-i; j++) {
					if((10000*i+5000*j+1000*(n-i-j))==y) {
						output = String.format("%d %d %d", i,j,(n-i-j));
						return;
					}
				}
			}
			output = "-1 -1 -1";
			return ;
		}

		public void writeOutput() {
			System.out.println(output);
		}

	}

} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws IOException{
		Otoshidama solver = new Otoshidama();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	}


	static class Otoshidama {

		private int y;
		private int n;

		private Scanner scanner;
		private String output;

		public Otoshidama() {
			scanner = new Scanner(System.in);
		}

		public void readInput() {
			n = Integer.parseInt(scanner.next());
			y = Integer.parseInt(scanner.next());
			return ;
		}

		public void solve() {
			for(int i=0; i<=n;i++) {
				for(int j=0; j<=n-i; j++) {
					if((10000*i+5000*j+1000*(n-i-j))==y) {
						output = String.format("%d %d %d", i,j,(n-i-j));
						return;
					}
				}
			}
			output = "-1 -1 -1";
			return ;
		}

		public void writeOutput() {
			System.out.println(output);
		}

	}

} Main public static void main(String[] args) throws IOException{
		Otoshidama solver = new Otoshidama();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	} main {
		Otoshidama solver = new Otoshidama();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	} Otoshidama solver = new Otoshidama(); solver new Otoshidama() solver.readInput() solver.readInput solver solver.solve() solver.solve solver solver.writeOutput() solver.writeOutput solver String[] args args static class Otoshidama {

		private int y;
		private int n;

		private Scanner scanner;
		private String output;

		public Otoshidama() {
			scanner = new Scanner(System.in);
		}

		public void readInput() {
			n = Integer.parseInt(scanner.next());
			y = Integer.parseInt(scanner.next());
			return ;
		}

		public void solve() {
			for(int i=0; i<=n;i++) {
				for(int j=0; j<=n-i; j++) {
					if((10000*i+5000*j+1000*(n-i-j))==y) {
						output = String.format("%d %d %d", i,j,(n-i-j));
						return;
					}
				}
			}
			output = "-1 -1 -1";
			return ;
		}

		public void writeOutput() {
			System.out.println(output);
		}

	} Otoshidama private int y; y private int n; n private Scanner scanner; scanner private String output; output public Otoshidama() {
			scanner = new Scanner(System.in);
		} Otoshidama {
			scanner = new Scanner(System.in);
		} scanner = new Scanner(System.in) scanner new Scanner(System.in) public void readInput() {
			n = Integer.parseInt(scanner.next());
			y = Integer.parseInt(scanner.next());
			return ;
		} readInput {
			n = Integer.parseInt(scanner.next());
			y = Integer.parseInt(scanner.next());
			return ;
		} n = Integer.parseInt(scanner.next()) n Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner y = Integer.parseInt(scanner.next()) y Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner return ; public void solve() {
			for(int i=0; i<=n;i++) {
				for(int j=0; j<=n-i; j++) {
					if((10000*i+5000*j+1000*(n-i-j))==y) {
						output = String.format("%d %d %d", i,j,(n-i-j));
						return;
					}
				}
			}
			output = "-1 -1 -1";
			return ;
		} solve {
			for(int i=0; i<=n;i++) {
				for(int j=0; j<=n-i; j++) {
					if((10000*i+5000*j+1000*(n-i-j))==y) {
						output = String.format("%d %d %d", i,j,(n-i-j));
						return;
					}
				}
			}
			output = "-1 -1 -1";
			return ;
		} for(int i=0; i<=n;i++) {
				for(int j=0; j<=n-i; j++) {
					if((10000*i+5000*j+1000*(n-i-j))==y) {
						output = String.format("%d %d %d", i,j,(n-i-j));
						return;
					}
				}
			} int i=0; int i=0; i 0 i<=n i n i++ i++ i {
				for(int j=0; j<=n-i; j++) {
					if((10000*i+5000*j+1000*(n-i-j))==y) {
						output = String.format("%d %d %d", i,j,(n-i-j));
						return;
					}
				}
			} {
				for(int j=0; j<=n-i; j++) {
					if((10000*i+5000*j+1000*(n-i-j))==y) {
						output = String.format("%d %d %d", i,j,(n-i-j));
						return;
					}
				}
			} for(int j=0; j<=n-i; j++) {
					if((10000*i+5000*j+1000*(n-i-j))==y) {
						output = String.format("%d %d %d", i,j,(n-i-j));
						return;
					}
				} int j=0; int j=0; j 0 j<=n-i j n-i n i j++ j++ j {
					if((10000*i+5000*j+1000*(n-i-j))==y) {
						output = String.format("%d %d %d", i,j,(n-i-j));
						return;
					}
				} {
					if((10000*i+5000*j+1000*(n-i-j))==y) {
						output = String.format("%d %d %d", i,j,(n-i-j));
						return;
					}
				} if((10000*i+5000*j+1000*(n-i-j))==y) {
						output = String.format("%d %d %d", i,j,(n-i-j));
						return;
					} (10000*i+5000*j+1000*(n-i-j))==y (10000*i+5000*j+1000*(n-i-j)) 10000*i+5000*j+1000*(n-i-j) 10000*i 10000 i 5000*j 5000 j 1000*(n-i-j) 1000 (n-i-j) n-i-j n i j y {
						output = String.format("%d %d %d", i,j,(n-i-j));
						return;
					} output = String.format("%d %d %d", i,j,(n-i-j)) output String.format("%d %d %d", i,j,(n-i-j)) String.format String "%d %d %d" i j (n-i-j) n-i-j n i j return; output = "-1 -1 -1" output "-1 -1 -1" return ; public void writeOutput() {
			System.out.println(output);
		} writeOutput {
			System.out.println(output);
		} System.out.println(output) System.out.println System.out System System.out output public class Main {
	public static void main(String[] args) throws IOException{
		Otoshidama solver = new Otoshidama();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	}


	static class Otoshidama {

		private int y;
		private int n;

		private Scanner scanner;
		private String output;

		public Otoshidama() {
			scanner = new Scanner(System.in);
		}

		public void readInput() {
			n = Integer.parseInt(scanner.next());
			y = Integer.parseInt(scanner.next());
			return ;
		}

		public void solve() {
			for(int i=0; i<=n;i++) {
				for(int j=0; j<=n-i; j++) {
					if((10000*i+5000*j+1000*(n-i-j))==y) {
						output = String.format("%d %d %d", i,j,(n-i-j));
						return;
					}
				}
			}
			output = "-1 -1 -1";
			return ;
		}

		public void writeOutput() {
			System.out.println(output);
		}

	}

} public class Main {
	public static void main(String[] args) throws IOException{
		Otoshidama solver = new Otoshidama();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	}


	static class Otoshidama {

		private int y;
		private int n;

		private Scanner scanner;
		private String output;

		public Otoshidama() {
			scanner = new Scanner(System.in);
		}

		public void readInput() {
			n = Integer.parseInt(scanner.next());
			y = Integer.parseInt(scanner.next());
			return ;
		}

		public void solve() {
			for(int i=0; i<=n;i++) {
				for(int j=0; j<=n-i; j++) {
					if((10000*i+5000*j+1000*(n-i-j))==y) {
						output = String.format("%d %d %d", i,j,(n-i-j));
						return;
					}
				}
			}
			output = "-1 -1 -1";
			return ;
		}

		public void writeOutput() {
			System.out.println(output);
		}

	}

} Main
import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException{
		Otoshidama solver = new Otoshidama();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	}


	static class Otoshidama {

		private int y;
		private int n;

		private Scanner scanner;
		private String output;

		public Otoshidama() {
			scanner = new Scanner(System.in);
		}

		public void readInput() {
			n = Integer.parseInt(scanner.next());
			y = Integer.parseInt(scanner.next());
			return ;
		}

		public void solve() {
			for(int i=0; i<=n;i++) {
				for(int j=0; j<=n-i; j++) {
					if((10000*i+5000*j+1000*(n-i-j))==y) {
						output = String.format("%d %d %d", i,j,(n-i-j));
						return;
					}
				}
			}
			output = "-1 -1 -1";
			return ;
		}

		public void writeOutput() {
			System.out.println(output);
		}

	}

}