import java.util.*;

public class Main {
    public static void main(String[] args){
        // Your code here!
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int Y = sc.nextInt();
        
        boolean flag = false;
        
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= (N-i); j++){
                for(int k = 0; k <= (N-i-j) ; k++){
                    int sum = 0;
                    int count = 0;
                     
                    sum = (10000 * i) + (5000 * j) + (1000 * k);
                    count = i + j + k;
                    if(sum == Y && count == N){
                        System.out.println(i + " " + j + " " + k);
                        flag = true; 
                        break;
                    }
                }
                
                if(flag){
                    break;
                }
            }
            
            if(flag){
                break;
            }
        }
        
        if(flag == false){
            System.out.println("-1 -1 -1");
        }
        
    }
    
} import java.util.*; util.* java public class Main {
    public static void main(String[] args){
        // Your code here!
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int Y = sc.nextInt();
        
        boolean flag = false;
        
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= (N-i); j++){
                for(int k = 0; k <= (N-i-j) ; k++){
                    int sum = 0;
                    int count = 0;
                     
                    sum = (10000 * i) + (5000 * j) + (1000 * k);
                    count = i + j + k;
                    if(sum == Y && count == N){
                        System.out.println(i + " " + j + " " + k);
                        flag = true; 
                        break;
                    }
                }
                
                if(flag){
                    break;
                }
            }
            
            if(flag){
                break;
            }
        }
        
        if(flag == false){
            System.out.println("-1 -1 -1");
        }
        
    }
    
} Main public static void main(String[] args){
        // Your code here!
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int Y = sc.nextInt();
        
        boolean flag = false;
        
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= (N-i); j++){
                for(int k = 0; k <= (N-i-j) ; k++){
                    int sum = 0;
                    int count = 0;
                     
                    sum = (10000 * i) + (5000 * j) + (1000 * k);
                    count = i + j + k;
                    if(sum == Y && count == N){
                        System.out.println(i + " " + j + " " + k);
                        flag = true; 
                        break;
                    }
                }
                
                if(flag){
                    break;
                }
            }
            
            if(flag){
                break;
            }
        }
        
        if(flag == false){
            System.out.println("-1 -1 -1");
        }
        
    } main {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int Y = sc.nextInt();
        
        boolean flag = false;
        
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= (N-i); j++){
                for(int k = 0; k <= (N-i-j) ; k++){
                    int sum = 0;
                    int count = 0;
                     
                    sum = (10000 * i) + (5000 * j) + (1000 * k);
                    count = i + j + k;
                    if(sum == Y && count == N){
                        System.out.println(i + " " + j + " " + k);
                        flag = true; 
                        break;
                    }
                }
                
                if(flag){
                    break;
                }
            }
            
            if(flag){
                break;
            }
        }
        
        if(flag == false){
            System.out.println("-1 -1 -1");
        }
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int Y = sc.nextInt(); Y sc.nextInt() sc.nextInt sc boolean flag = false; flag false for(int i = 0; i <= N; i++){
            for(int j = 0; j <= (N-i); j++){
                for(int k = 0; k <= (N-i-j) ; k++){
                    int sum = 0;
                    int count = 0;
                     
                    sum = (10000 * i) + (5000 * j) + (1000 * k);
                    count = i + j + k;
                    if(sum == Y && count == N){
                        System.out.println(i + " " + j + " " + k);
                        flag = true; 
                        break;
                    }
                }
                
                if(flag){
                    break;
                }
            }
            
            if(flag){
                break;
            }
        } int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
            for(int j = 0; j <= (N-i); j++){
                for(int k = 0; k <= (N-i-j) ; k++){
                    int sum = 0;
                    int count = 0;
                     
                    sum = (10000 * i) + (5000 * j) + (1000 * k);
                    count = i + j + k;
                    if(sum == Y && count == N){
                        System.out.println(i + " " + j + " " + k);
                        flag = true; 
                        break;
                    }
                }
                
                if(flag){
                    break;
                }
            }
            
            if(flag){
                break;
            }
        } {
            for(int j = 0; j <= (N-i); j++){
                for(int k = 0; k <= (N-i-j) ; k++){
                    int sum = 0;
                    int count = 0;
                     
                    sum = (10000 * i) + (5000 * j) + (1000 * k);
                    count = i + j + k;
                    if(sum == Y && count == N){
                        System.out.println(i + " " + j + " " + k);
                        flag = true; 
                        break;
                    }
                }
                
                if(flag){
                    break;
                }
            }
            
            if(flag){
                break;
            }
        } for(int j = 0; j <= (N-i); j++){
                for(int k = 0; k <= (N-i-j) ; k++){
                    int sum = 0;
                    int count = 0;
                     
                    sum = (10000 * i) + (5000 * j) + (1000 * k);
                    count = i + j + k;
                    if(sum == Y && count == N){
                        System.out.println(i + " " + j + " " + k);
                        flag = true; 
                        break;
                    }
                }
                
                if(flag){
                    break;
                }
            } int j = 0; int j = 0; j 0 j <= (N-i) j (N-i) N i j++ j++ j {
                for(int k = 0; k <= (N-i-j) ; k++){
                    int sum = 0;
                    int count = 0;
                     
                    sum = (10000 * i) + (5000 * j) + (1000 * k);
                    count = i + j + k;
                    if(sum == Y && count == N){
                        System.out.println(i + " " + j + " " + k);
                        flag = true; 
                        break;
                    }
                }
                
                if(flag){
                    break;
                }
            } {
                for(int k = 0; k <= (N-i-j) ; k++){
                    int sum = 0;
                    int count = 0;
                     
                    sum = (10000 * i) + (5000 * j) + (1000 * k);
                    count = i + j + k;
                    if(sum == Y && count == N){
                        System.out.println(i + " " + j + " " + k);
                        flag = true; 
                        break;
                    }
                }
                
                if(flag){
                    break;
                }
            } for(int k = 0; k <= (N-i-j) ; k++){
                    int sum = 0;
                    int count = 0;
                     
                    sum = (10000 * i) + (5000 * j) + (1000 * k);
                    count = i + j + k;
                    if(sum == Y && count == N){
                        System.out.println(i + " " + j + " " + k);
                        flag = true; 
                        break;
                    }
                } int k = 0; int k = 0; k 0 k <= (N-i-j) k (N-i-j) N-i-j N i j k++ k++ k {
                    int sum = 0;
                    int count = 0;
                     
                    sum = (10000 * i) + (5000 * j) + (1000 * k);
                    count = i + j + k;
                    if(sum == Y && count == N){
                        System.out.println(i + " " + j + " " + k);
                        flag = true; 
                        break;
                    }
                } {
                    int sum = 0;
                    int count = 0;
                     
                    sum = (10000 * i) + (5000 * j) + (1000 * k);
                    count = i + j + k;
                    if(sum == Y && count == N){
                        System.out.println(i + " " + j + " " + k);
                        flag = true; 
                        break;
                    }
                } int sum = 0; sum 0 int count = 0; count 0 sum = (10000 * i) + (5000 * j) + (1000 * k) sum (10000 * i) + (5000 * j) + (1000 * k) (10000 * i) + (5000 * j) + (1000 * k) (10000 * i) 10000 i (5000 * j) 5000 j (1000 * k) 1000 k count = i + j + k count i + j + k i + j + k i j k if(sum == Y && count == N){
                        System.out.println(i + " " + j + " " + k);
                        flag = true; 
                        break;
                    } sum == Y && count == N sum == Y sum Y count == N count N {
                        System.out.println(i + " " + j + " " + k);
                        flag = true; 
                        break;
                    } System.out.println(i + " " + j + " " + k) System.out.println System.out System System.out i + " " + j + " " + k " " j i + " " + j + " " + k i " " j " " k flag = true flag true break; if(flag){
                    break;
                } flag {
                    break;
                } break; if(flag){
                break;
            } flag {
                break;
            } break; if(flag == false){
            System.out.println("-1 -1 -1");
        } flag == false flag false {
            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){
        // Your code here!
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int Y = sc.nextInt();
        
        boolean flag = false;
        
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= (N-i); j++){
                for(int k = 0; k <= (N-i-j) ; k++){
                    int sum = 0;
                    int count = 0;
                     
                    sum = (10000 * i) + (5000 * j) + (1000 * k);
                    count = i + j + k;
                    if(sum == Y && count == N){
                        System.out.println(i + " " + j + " " + k);
                        flag = true; 
                        break;
                    }
                }
                
                if(flag){
                    break;
                }
            }
            
            if(flag){
                break;
            }
        }
        
        if(flag == false){
            System.out.println("-1 -1 -1");
        }
        
    }
    
} public class Main {
    public static void main(String[] args){
        // Your code here!
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int Y = sc.nextInt();
        
        boolean flag = false;
        
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= (N-i); j++){
                for(int k = 0; k <= (N-i-j) ; k++){
                    int sum = 0;
                    int count = 0;
                     
                    sum = (10000 * i) + (5000 * j) + (1000 * k);
                    count = i + j + k;
                    if(sum == Y && count == N){
                        System.out.println(i + " " + j + " " + k);
                        flag = true; 
                        break;
                    }
                }
                
                if(flag){
                    break;
                }
            }
            
            if(flag){
                break;
            }
        }
        
        if(flag == false){
            System.out.println("-1 -1 -1");
        }
        
    }
    
} Main
import java.util.*;

public class Main {
    public static void main(String[] args){
        // Your code here!
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int Y = sc.nextInt();
        
        boolean flag = false;
        
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= (N-i); j++){
                for(int k = 0; k <= (N-i-j) ; k++){
                    int sum = 0;
                    int count = 0;
                     
                    sum = (10000 * i) + (5000 * j) + (1000 * k);
                    count = i + j + k;
                    if(sum == Y && count == N){
                        System.out.println(i + " " + j + " " + k);
                        flag = true; 
                        break;
                    }
                }
                
                if(flag){
                    break;
                }
            }
            
            if(flag){
                break;
            }
        }
        
        if(flag == false){
            System.out.println("-1 -1 -1");
        }
        
    }
    
}
