import java.util.Scanner;

public class Main{
	
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		// input
		int num = scan.nextInt();
		int otoshidama = scan.nextInt();
		
		// search
		boolean flag = false;
		loop: for(int i = 0; i <= num; i++){
			for(int j = 0; j <= num - i; j++){
				if(10000 * i + 5000 * j + 1000 * (num - i - j) == otoshidama){
					System.out.println(i + " " + j + " " + (num - i - j));
					flag = true;
					break loop;
				}
			}
		}
		
		// answer
		if(!flag){
			System.out.println("-1 -1 -1");
		}
	}
} import java.util.Scanner; Scanner java.util public class Main{
	
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		// input
		int num = scan.nextInt();
		int otoshidama = scan.nextInt();
		
		// search
		boolean flag = false;
		loop: for(int i = 0; i <= num; i++){
			for(int j = 0; j <= num - i; j++){
				if(10000 * i + 5000 * j + 1000 * (num - i - j) == otoshidama){
					System.out.println(i + " " + j + " " + (num - i - j));
					flag = true;
					break loop;
				}
			}
		}
		
		// answer
		if(!flag){
			System.out.println("-1 -1 -1");
		}
	}
} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		// input
		int num = scan.nextInt();
		int otoshidama = scan.nextInt();
		
		// search
		boolean flag = false;
		loop: for(int i = 0; i <= num; i++){
			for(int j = 0; j <= num - i; j++){
				if(10000 * i + 5000 * j + 1000 * (num - i - j) == otoshidama){
					System.out.println(i + " " + j + " " + (num - i - j));
					flag = true;
					break loop;
				}
			}
		}
		
		// answer
		if(!flag){
			System.out.println("-1 -1 -1");
		}
	} main {
		Scanner scan = new Scanner(System.in);
		
		// input
		int num = scan.nextInt();
		int otoshidama = scan.nextInt();
		
		// search
		boolean flag = false;
		loop: for(int i = 0; i <= num; i++){
			for(int j = 0; j <= num - i; j++){
				if(10000 * i + 5000 * j + 1000 * (num - i - j) == otoshidama){
					System.out.println(i + " " + j + " " + (num - i - j));
					flag = true;
					break loop;
				}
			}
		}
		
		// answer
		if(!flag){
			System.out.println("-1 -1 -1");
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int num = scan.nextInt(); num scan.nextInt() scan.nextInt scan int otoshidama = scan.nextInt(); otoshidama scan.nextInt() scan.nextInt scan boolean flag = false; flag false if(!flag){
			System.out.println("-1 -1 -1");
		} !flag flag {
			System.out.println("-1 -1 -1");
		} 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 scan = new Scanner(System.in);
		
		// input
		int num = scan.nextInt();
		int otoshidama = scan.nextInt();
		
		// search
		boolean flag = false;
		loop: for(int i = 0; i <= num; i++){
			for(int j = 0; j <= num - i; j++){
				if(10000 * i + 5000 * j + 1000 * (num - i - j) == otoshidama){
					System.out.println(i + " " + j + " " + (num - i - j));
					flag = true;
					break loop;
				}
			}
		}
		
		// answer
		if(!flag){
			System.out.println("-1 -1 -1");
		}
	}
} public class Main{
	
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		// input
		int num = scan.nextInt();
		int otoshidama = scan.nextInt();
		
		// search
		boolean flag = false;
		loop: for(int i = 0; i <= num; i++){
			for(int j = 0; j <= num - i; j++){
				if(10000 * i + 5000 * j + 1000 * (num - i - j) == otoshidama){
					System.out.println(i + " " + j + " " + (num - i - j));
					flag = true;
					break loop;
				}
			}
		}
		
		// answer
		if(!flag){
			System.out.println("-1 -1 -1");
		}
	}
} Main
import java.util.Scanner;

public class Main{
	
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		// input
		int num = scan.nextInt();
		int otoshidama = scan.nextInt();
		
		// search
		boolean flag = false;
		loop: for(int i = 0; i <= num; i++){
			for(int j = 0; j <= num - i; j++){
				if(10000 * i + 5000 * j + 1000 * (num - i - j) == otoshidama){
					System.out.println(i + " " + j + " " + (num - i - j));
					flag = true;
					break loop;
				}
			}
		}
		
		// answer
		if(!flag){
			System.out.println("-1 -1 -1");
		}
	}
}