import java.util.*;
public class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int a = sc.nextInt(); 
      int b = sc.nextInt(); 

        
        for(int i = 0; i <= a ; i++ ){
            for(int j = 0; j <= (a-i) ; j++){
                for(int k = 0; k <= (a-i-j) ; k++){
                    if(10000 * i + 5000 * j + 1000 * k == b && i + j + k == a){
                        System.out.println(i+" "+j+" "+k);
                        return;
                    }
                }
            }
        } 
        System.out.println("-1 -1 -1");    
  }    
} import java.util.*; util.* java public class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int a = sc.nextInt(); 
      int b = sc.nextInt(); 

        
        for(int i = 0; i <= a ; i++ ){
            for(int j = 0; j <= (a-i) ; j++){
                for(int k = 0; k <= (a-i-j) ; k++){
                    if(10000 * i + 5000 * j + 1000 * k == b && i + j + k == a){
                        System.out.println(i+" "+j+" "+k);
                        return;
                    }
                }
            }
        } 
        System.out.println("-1 -1 -1");    
  }    
} Main public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int a = sc.nextInt(); 
      int b = sc.nextInt(); 

        
        for(int i = 0; i <= a ; i++ ){
            for(int j = 0; j <= (a-i) ; j++){
                for(int k = 0; k <= (a-i-j) ; k++){
                    if(10000 * i + 5000 * j + 1000 * k == b && i + j + k == a){
                        System.out.println(i+" "+j+" "+k);
                        return;
                    }
                }
            }
        } 
        System.out.println("-1 -1 -1");    
  } main {
      Scanner sc = new Scanner(System.in);
      int a = sc.nextInt(); 
      int b = sc.nextInt(); 

        
        for(int i = 0; i <= a ; i++ ){
            for(int j = 0; j <= (a-i) ; j++){
                for(int k = 0; k <= (a-i-j) ; k++){
                    if(10000 * i + 5000 * j + 1000 * k == b && i + j + k == a){
                        System.out.println(i+" "+j+" "+k);
                        return;
                    }
                }
            }
        } 
        System.out.println("-1 -1 -1");    
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc for(int i = 0; i <= a ; i++ ){
            for(int j = 0; j <= (a-i) ; j++){
                for(int k = 0; k <= (a-i-j) ; k++){
                    if(10000 * i + 5000 * j + 1000 * k == b && i + j + k == a){
                        System.out.println(i+" "+j+" "+k);
                        return;
                    }
                }
            }
        } int i = 0; int i = 0; i 0 i <= a i a i++ i++ i {
            for(int j = 0; j <= (a-i) ; j++){
                for(int k = 0; k <= (a-i-j) ; k++){
                    if(10000 * i + 5000 * j + 1000 * k == b && i + j + k == a){
                        System.out.println(i+" "+j+" "+k);
                        return;
                    }
                }
            }
        } {
            for(int j = 0; j <= (a-i) ; j++){
                for(int k = 0; k <= (a-i-j) ; k++){
                    if(10000 * i + 5000 * j + 1000 * k == b && i + j + k == a){
                        System.out.println(i+" "+j+" "+k);
                        return;
                    }
                }
            }
        } for(int j = 0; j <= (a-i) ; j++){
                for(int k = 0; k <= (a-i-j) ; k++){
                    if(10000 * i + 5000 * j + 1000 * k == b && i + j + k == a){
                        System.out.println(i+" "+j+" "+k);
                        return;
                    }
                }
            } int j = 0; int j = 0; j 0 j <= (a-i) j (a-i) a i j++ j++ j {
                for(int k = 0; k <= (a-i-j) ; k++){
                    if(10000 * i + 5000 * j + 1000 * k == b && i + j + k == a){
                        System.out.println(i+" "+j+" "+k);
                        return;
                    }
                }
            } {
                for(int k = 0; k <= (a-i-j) ; k++){
                    if(10000 * i + 5000 * j + 1000 * k == b && i + j + k == a){
                        System.out.println(i+" "+j+" "+k);
                        return;
                    }
                }
            } for(int k = 0; k <= (a-i-j) ; k++){
                    if(10000 * i + 5000 * j + 1000 * k == b && i + j + k == a){
                        System.out.println(i+" "+j+" "+k);
                        return;
                    }
                } int k = 0; int k = 0; k 0 k <= (a-i-j) k (a-i-j) a-i-j a i j k++ k++ k {
                    if(10000 * i + 5000 * j + 1000 * k == b && i + j + k == a){
                        System.out.println(i+" "+j+" "+k);
                        return;
                    }
                } {
                    if(10000 * i + 5000 * j + 1000 * k == b && i + j + k == a){
                        System.out.println(i+" "+j+" "+k);
                        return;
                    }
                } if(10000 * i + 5000 * j + 1000 * k == b && i + j + k == a){
                        System.out.println(i+" "+j+" "+k);
                        return;
                    } 10000 * i + 5000 * j + 1000 * k == b && i + j + k == a 10000 * i + 5000 * j + 1000 * k == b 10000 * i + 5000 * j + 1000 * k 10000 * i + 5000 * j + 1000 * k 10000 * i 10000 i 5000 * j 5000 j 1000 * k 1000 k b i + j + k == a i + j + k i + j + k i j k a {
                        System.out.println(i+" "+j+" "+k);
                        return;
                    } System.out.println(i+" "+j+" "+k) System.out.println System.out System System.out i+" "+j+" "+k " " j i+" "+j+" "+k i " " j " " k return; 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 sc = new Scanner(System.in);
      int a = sc.nextInt(); 
      int b = sc.nextInt(); 

        
        for(int i = 0; i <= a ; i++ ){
            for(int j = 0; j <= (a-i) ; j++){
                for(int k = 0; k <= (a-i-j) ; k++){
                    if(10000 * i + 5000 * j + 1000 * k == b && i + j + k == a){
                        System.out.println(i+" "+j+" "+k);
                        return;
                    }
                }
            }
        } 
        System.out.println("-1 -1 -1");    
  }    
} public class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int a = sc.nextInt(); 
      int b = sc.nextInt(); 

        
        for(int i = 0; i <= a ; i++ ){
            for(int j = 0; j <= (a-i) ; j++){
                for(int k = 0; k <= (a-i-j) ; k++){
                    if(10000 * i + 5000 * j + 1000 * k == b && i + j + k == a){
                        System.out.println(i+" "+j+" "+k);
                        return;
                    }
                }
            }
        } 
        System.out.println("-1 -1 -1");    
  }    
} Main
import java.util.*;
public class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int a = sc.nextInt(); 
      int b = sc.nextInt(); 

        
        for(int i = 0; i <= a ; i++ ){
            for(int j = 0; j <= (a-i) ; j++){
                for(int k = 0; k <= (a-i-j) ; k++){
                    if(10000 * i + 5000 * j + 1000 * k == b && i + j + k == a){
                        System.out.println(i+" "+j+" "+k);
                        return;
                    }
                }
            }
        } 
        System.out.println("-1 -1 -1");    
  }    
}