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++){
                int c = N - i - j;
                
                int sum = 0;
                int count = 0;
                 
                sum = (10000 * i) + (5000 * j) + (1000 * c);
                count = i + j + c;
                if(sum == Y && count == N){
                    System.out.println(i + " " + j + " " + c);
                    flag = true; 
                    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++){
                int c = N - i - j;
                
                int sum = 0;
                int count = 0;
                 
                sum = (10000 * i) + (5000 * j) + (1000 * c);
                count = i + j + c;
                if(sum == Y && count == N){
                    System.out.println(i + " " + j + " " + c);
                    flag = true; 
                    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++){
                int c = N - i - j;
                
                int sum = 0;
                int count = 0;
                 
                sum = (10000 * i) + (5000 * j) + (1000 * c);
                count = i + j + c;
                if(sum == Y && count == N){
                    System.out.println(i + " " + j + " " + c);
                    flag = true; 
                    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++){
                int c = N - i - j;
                
                int sum = 0;
                int count = 0;
                 
                sum = (10000 * i) + (5000 * j) + (1000 * c);
                count = i + j + c;
                if(sum == Y && count == N){
                    System.out.println(i + " " + j + " " + c);
                    flag = true; 
                    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++){
                int c = N - i - j;
                
                int sum = 0;
                int count = 0;
                 
                sum = (10000 * i) + (5000 * j) + (1000 * c);
                count = i + j + c;
                if(sum == Y && count == N){
                    System.out.println(i + " " + j + " " + c);
                    flag = true; 
                    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++){
                int c = N - i - j;
                
                int sum = 0;
                int count = 0;
                 
                sum = (10000 * i) + (5000 * j) + (1000 * c);
                count = i + j + c;
                if(sum == Y && count == N){
                    System.out.println(i + " " + j + " " + c);
                    flag = true; 
                    break;
                }
            }
            
            if(flag){
                break;
            }
        } {
            for(int j = 0; j <= (N-i); j++){
                int c = N - i - j;
                
                int sum = 0;
                int count = 0;
                 
                sum = (10000 * i) + (5000 * j) + (1000 * c);
                count = i + j + c;
                if(sum == Y && count == N){
                    System.out.println(i + " " + j + " " + c);
                    flag = true; 
                    break;
                }
            }
            
            if(flag){
                break;
            }
        } for(int j = 0; j <= (N-i); j++){
                int c = N - i - j;
                
                int sum = 0;
                int count = 0;
                 
                sum = (10000 * i) + (5000 * j) + (1000 * c);
                count = i + j + c;
                if(sum == Y && count == N){
                    System.out.println(i + " " + j + " " + c);
                    flag = true; 
                    break;
                }
            } int j = 0; int j = 0; j 0 j <= (N-i) j (N-i) N i j++ j++ j {
                int c = N - i - j;
                
                int sum = 0;
                int count = 0;
                 
                sum = (10000 * i) + (5000 * j) + (1000 * c);
                count = i + j + c;
                if(sum == Y && count == N){
                    System.out.println(i + " " + j + " " + c);
                    flag = true; 
                    break;
                }
            } {
                int c = N - i - j;
                
                int sum = 0;
                int count = 0;
                 
                sum = (10000 * i) + (5000 * j) + (1000 * c);
                count = i + j + c;
                if(sum == Y && count == N){
                    System.out.println(i + " " + j + " " + c);
                    flag = true; 
                    break;
                }
            } int c = N - i - j; c N - i - j N - i - j N i j int sum = 0; sum 0 int count = 0; count 0 sum = (10000 * i) + (5000 * j) + (1000 * c) sum (10000 * i) + (5000 * j) + (1000 * c) (10000 * i) + (5000 * j) + (1000 * c) (10000 * i) 10000 i (5000 * j) 5000 j (1000 * c) 1000 c count = i + j + c count i + j + c i + j + c i j c if(sum == Y && count == N){
                    System.out.println(i + " " + j + " " + c);
                    flag = true; 
                    break;
                } sum == Y && count == N sum == Y sum Y count == N count N {
                    System.out.println(i + " " + j + " " + c);
                    flag = true; 
                    break;
                } System.out.println(i + " " + j + " " + c) System.out.println System.out System System.out i + " " + j + " " + c " " j i + " " + j + " " + c i " " j " " c flag = true flag true 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++){
                int c = N - i - j;
                
                int sum = 0;
                int count = 0;
                 
                sum = (10000 * i) + (5000 * j) + (1000 * c);
                count = i + j + c;
                if(sum == Y && count == N){
                    System.out.println(i + " " + j + " " + c);
                    flag = true; 
                    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++){
                int c = N - i - j;
                
                int sum = 0;
                int count = 0;
                 
                sum = (10000 * i) + (5000 * j) + (1000 * c);
                count = i + j + c;
                if(sum == Y && count == N){
                    System.out.println(i + " " + j + " " + c);
                    flag = true; 
                    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++){
                int c = N - i - j;
                
                int sum = 0;
                int count = 0;
                 
                sum = (10000 * i) + (5000 * j) + (1000 * c);
                count = i + j + c;
                if(sum == Y && count == N){
                    System.out.println(i + " " + j + " " + c);
                    flag = true; 
                    break;
                }
            }
            
            if(flag){
                break;
            }
        }
        
        if(flag == false){
            System.out.println("-1 -1 -1");
        }
        
    }
    
}
