import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int N;
    int Y;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.nextInt();
        this.Y = sc.nextInt();
    }
    
    //解答処理
    private int[] solve() {
        int[] answer = new int[3];
        answer[0] = -1;	//10000円
		answer[1] = -1;	//5000円
		answer[2] = -1;	//1000円
        
        for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
              int k = N-i-j;
              if(Y == 10000*i + 5000*j + 1000*k){
            	  answer[0] = i; //10000円
            	  answer[1] = j; //5000円
            	  answer[2] = k; //1000円
              }
            }
          }
        
        return answer;
    }
    
    //出力
    public void show(int[] answer) {
    	for (int i=0; i<3; i++) {
    		System.out.print(answer[i]);
    		System.out.print(" ");	
    	}
    }

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int N;
    int Y;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.nextInt();
        this.Y = sc.nextInt();
    }
    
    //解答処理
    private int[] solve() {
        int[] answer = new int[3];
        answer[0] = -1;	//10000円
		answer[1] = -1;	//5000円
		answer[2] = -1;	//1000円
        
        for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
              int k = N-i-j;
              if(Y == 10000*i + 5000*j + 1000*k){
            	  answer[0] = i; //10000円
            	  answer[1] = j; //5000円
            	  answer[2] = k; //1000円
              }
            }
          }
        
        return answer;
    }
    
    //出力
    public void show(int[] answer) {
    	for (int i=0; i<3; i++) {
    		System.out.print(answer[i]);
    		System.out.print(" ");	
    	}
    }

} Main //フィールド
    Scanner sc; sc int N; N int Y; Y public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Main m = new Main(sc); m new Main(sc) m.show(m.solve()) m.show m m.solve() m.solve m sc.close() sc.close sc String[] args args //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.nextInt();
        this.Y = sc.nextInt();
    } Main {
        this.sc = sc;
        this.N = sc.nextInt();
        this.Y = sc.nextInt();
    } this.sc = sc this.sc this this.sc sc this.N = sc.nextInt() this.N this this.N sc.nextInt() sc.nextInt sc this.Y = sc.nextInt() this.Y this this.Y sc.nextInt() sc.nextInt sc Scanner sc sc //解答処理
    private int[] solve() {
        int[] answer = new int[3];
        answer[0] = -1;	//10000円
		answer[1] = -1;	//5000円
		answer[2] = -1;	//1000円
        
        for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
              int k = N-i-j;
              if(Y == 10000*i + 5000*j + 1000*k){
            	  answer[0] = i; //10000円
            	  answer[1] = j; //5000円
            	  answer[2] = k; //1000円
              }
            }
          }
        
        return answer;
    } solve {
        int[] answer = new int[3];
        answer[0] = -1;	//10000円
		answer[1] = -1;	//5000円
		answer[2] = -1;	//1000円
        
        for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
              int k = N-i-j;
              if(Y == 10000*i + 5000*j + 1000*k){
            	  answer[0] = i; //10000円
            	  answer[1] = j; //5000円
            	  answer[2] = k; //1000円
              }
            }
          }
        
        return answer;
    } int[] answer = new int[3]; answer new int[3] 3 answer[0] = -1 answer[0] answer 0 -1 1 answer[1] = -1 answer[1] answer 1 -1 1 answer[2] = -1 answer[2] answer 2 -1 1 for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
              int k = N-i-j;
              if(Y == 10000*i + 5000*j + 1000*k){
            	  answer[0] = i; //10000円
            	  answer[1] = j; //5000円
            	  answer[2] = k; //1000円
              }
            }
          } int i=0; int i=0; i 0 i<=N i N i++ i++ i {
            for(int j=0;j<=N-i;j++){
              int k = N-i-j;
              if(Y == 10000*i + 5000*j + 1000*k){
            	  answer[0] = i; //10000円
            	  answer[1] = j; //5000円
            	  answer[2] = k; //1000円
              }
            }
          } {
            for(int j=0;j<=N-i;j++){
              int k = N-i-j;
              if(Y == 10000*i + 5000*j + 1000*k){
            	  answer[0] = i; //10000円
            	  answer[1] = j; //5000円
            	  answer[2] = k; //1000円
              }
            }
          } for(int j=0;j<=N-i;j++){
              int k = N-i-j;
              if(Y == 10000*i + 5000*j + 1000*k){
            	  answer[0] = i; //10000円
            	  answer[1] = j; //5000円
            	  answer[2] = k; //1000円
              }
            } int j=0; int j=0; j 0 j<=N-i j N-i N i j++ j++ j {
              int k = N-i-j;
              if(Y == 10000*i + 5000*j + 1000*k){
            	  answer[0] = i; //10000円
            	  answer[1] = j; //5000円
            	  answer[2] = k; //1000円
              }
            } {
              int k = N-i-j;
              if(Y == 10000*i + 5000*j + 1000*k){
            	  answer[0] = i; //10000円
            	  answer[1] = j; //5000円
            	  answer[2] = k; //1000円
              }
            } int k = N-i-j; k N-i-j N-i-j N i j if(Y == 10000*i + 5000*j + 1000*k){
            	  answer[0] = i; //10000円
            	  answer[1] = j; //5000円
            	  answer[2] = k; //1000円
              } Y == 10000*i + 5000*j + 1000*k Y 10000*i + 5000*j + 1000*k 10000*i + 5000*j + 1000*k 10000*i 10000 i 5000*j 5000 j 1000*k 1000 k {
            	  answer[0] = i; //10000円
            	  answer[1] = j; //5000円
            	  answer[2] = k; //1000円
              } answer[0] = i answer[0] answer 0 i answer[1] = j answer[1] answer 1 j answer[2] = k answer[2] answer 2 k return answer; answer //出力
    public void show(int[] answer) {
    	for (int i=0; i<3; i++) {
    		System.out.print(answer[i]);
    		System.out.print(" ");	
    	}
    } show {
    	for (int i=0; i<3; i++) {
    		System.out.print(answer[i]);
    		System.out.print(" ");	
    	}
    } for (int i=0; i<3; i++) {
    		System.out.print(answer[i]);
    		System.out.print(" ");	
    	} int i=0; int i=0; i 0 i<3 i 3 i++ i++ i {
    		System.out.print(answer[i]);
    		System.out.print(" ");	
    	} {
    		System.out.print(answer[i]);
    		System.out.print(" ");	
    	} System.out.print(answer[i]) System.out.print System.out System System.out answer[i] answer i System.out.print(" ") System.out.print System.out System System.out " " int[] answer answer public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int N;
    int Y;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.nextInt();
        this.Y = sc.nextInt();
    }
    
    //解答処理
    private int[] solve() {
        int[] answer = new int[3];
        answer[0] = -1;	//10000円
		answer[1] = -1;	//5000円
		answer[2] = -1;	//1000円
        
        for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
              int k = N-i-j;
              if(Y == 10000*i + 5000*j + 1000*k){
            	  answer[0] = i; //10000円
            	  answer[1] = j; //5000円
            	  answer[2] = k; //1000円
              }
            }
          }
        
        return answer;
    }
    
    //出力
    public void show(int[] answer) {
    	for (int i=0; i<3; i++) {
    		System.out.print(answer[i]);
    		System.out.print(" ");	
    	}
    }

} public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int N;
    int Y;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.nextInt();
        this.Y = sc.nextInt();
    }
    
    //解答処理
    private int[] solve() {
        int[] answer = new int[3];
        answer[0] = -1;	//10000円
		answer[1] = -1;	//5000円
		answer[2] = -1;	//1000円
        
        for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
              int k = N-i-j;
              if(Y == 10000*i + 5000*j + 1000*k){
            	  answer[0] = i; //10000円
            	  answer[1] = j; //5000円
            	  answer[2] = k; //1000円
              }
            }
          }
        
        return answer;
    }
    
    //出力
    public void show(int[] answer) {
    	for (int i=0; i<3; i++) {
    		System.out.print(answer[i]);
    		System.out.print(" ");	
    	}
    }

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int N;
    int Y;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.nextInt();
        this.Y = sc.nextInt();
    }
    
    //解答処理
    private int[] solve() {
        int[] answer = new int[3];
        answer[0] = -1;	//10000円
		answer[1] = -1;	//5000円
		answer[2] = -1;	//1000円
        
        for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
              int k = N-i-j;
              if(Y == 10000*i + 5000*j + 1000*k){
            	  answer[0] = i; //10000円
            	  answer[1] = j; //5000円
            	  answer[2] = k; //1000円
              }
            }
          }
        
        return answer;
    }
    
    //出力
    public void show(int[] answer) {
    	for (int i=0; i<3; i++) {
    		System.out.print(answer[i]);
    		System.out.print(" ");	
    	}
    }

}
