import java.util.*;
import java.util.Arrays;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);
        
        int count = scanner.nextInt();
        int sum = scanner.nextInt();
        int ten_thou = 10000;
        int five_thou = 5000;
        int thou = 1000;
        int z = 0;
        boolean lie = true;
        
        
        
        for(int x=0;x<count+1;x++){
            if(sum % ten_thou == 0 && sum/ten_thou==count){
                System.out.print(count+" 0 0");
                lie = false;
                break;
            }else{
            for(int y=0;y<count+1-x;y++){
                z = count - (x+y);
                        if((10000*x + 5000*y + 1000*z) == sum){
                            
                           System.out.print(x+" "+y+" "+z);
                           lie = false;
                            break;
                        }
            }
                }
                
                if(!lie)break;
                
            }
            
            if(lie){
                    
                    System.out.print("-1 -1 -1");
                }
            
        }
        
        
} import java.util.*; util.* java import java.util.Arrays; Arrays java.util public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);
        
        int count = scanner.nextInt();
        int sum = scanner.nextInt();
        int ten_thou = 10000;
        int five_thou = 5000;
        int thou = 1000;
        int z = 0;
        boolean lie = true;
        
        
        
        for(int x=0;x<count+1;x++){
            if(sum % ten_thou == 0 && sum/ten_thou==count){
                System.out.print(count+" 0 0");
                lie = false;
                break;
            }else{
            for(int y=0;y<count+1-x;y++){
                z = count - (x+y);
                        if((10000*x + 5000*y + 1000*z) == sum){
                            
                           System.out.print(x+" "+y+" "+z);
                           lie = false;
                            break;
                        }
            }
                }
                
                if(!lie)break;
                
            }
            
            if(lie){
                    
                    System.out.print("-1 -1 -1");
                }
            
        }
        
        
} Main public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);
        
        int count = scanner.nextInt();
        int sum = scanner.nextInt();
        int ten_thou = 10000;
        int five_thou = 5000;
        int thou = 1000;
        int z = 0;
        boolean lie = true;
        
        
        
        for(int x=0;x<count+1;x++){
            if(sum % ten_thou == 0 && sum/ten_thou==count){
                System.out.print(count+" 0 0");
                lie = false;
                break;
            }else{
            for(int y=0;y<count+1-x;y++){
                z = count - (x+y);
                        if((10000*x + 5000*y + 1000*z) == sum){
                            
                           System.out.print(x+" "+y+" "+z);
                           lie = false;
                            break;
                        }
            }
                }
                
                if(!lie)break;
                
            }
            
            if(lie){
                    
                    System.out.print("-1 -1 -1");
                }
            
        } main {
        Scanner scanner = new Scanner(System.in);
        
        int count = scanner.nextInt();
        int sum = scanner.nextInt();
        int ten_thou = 10000;
        int five_thou = 5000;
        int thou = 1000;
        int z = 0;
        boolean lie = true;
        
        
        
        for(int x=0;x<count+1;x++){
            if(sum % ten_thou == 0 && sum/ten_thou==count){
                System.out.print(count+" 0 0");
                lie = false;
                break;
            }else{
            for(int y=0;y<count+1-x;y++){
                z = count - (x+y);
                        if((10000*x + 5000*y + 1000*z) == sum){
                            
                           System.out.print(x+" "+y+" "+z);
                           lie = false;
                            break;
                        }
            }
                }
                
                if(!lie)break;
                
            }
            
            if(lie){
                    
                    System.out.print("-1 -1 -1");
                }
            
        } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int count = scanner.nextInt(); count scanner.nextInt() scanner.nextInt scanner int sum = scanner.nextInt(); sum scanner.nextInt() scanner.nextInt scanner int ten_thou = 10000; ten_thou 10000 int five_thou = 5000; five_thou 5000 int thou = 1000; thou 1000 int z = 0; z 0 boolean lie = true; lie true for(int x=0;x<count+1;x++){
            if(sum % ten_thou == 0 && sum/ten_thou==count){
                System.out.print(count+" 0 0");
                lie = false;
                break;
            }else{
            for(int y=0;y<count+1-x;y++){
                z = count - (x+y);
                        if((10000*x + 5000*y + 1000*z) == sum){
                            
                           System.out.print(x+" "+y+" "+z);
                           lie = false;
                            break;
                        }
            }
                }
                
                if(!lie)break;
                
            } int x=0; int x=0; x 0 x<count+1 x count+1 count 1 x++ x++ x {
            if(sum % ten_thou == 0 && sum/ten_thou==count){
                System.out.print(count+" 0 0");
                lie = false;
                break;
            }else{
            for(int y=0;y<count+1-x;y++){
                z = count - (x+y);
                        if((10000*x + 5000*y + 1000*z) == sum){
                            
                           System.out.print(x+" "+y+" "+z);
                           lie = false;
                            break;
                        }
            }
                }
                
                if(!lie)break;
                
            } {
            if(sum % ten_thou == 0 && sum/ten_thou==count){
                System.out.print(count+" 0 0");
                lie = false;
                break;
            }else{
            for(int y=0;y<count+1-x;y++){
                z = count - (x+y);
                        if((10000*x + 5000*y + 1000*z) == sum){
                            
                           System.out.print(x+" "+y+" "+z);
                           lie = false;
                            break;
                        }
            }
                }
                
                if(!lie)break;
                
            } if(sum % ten_thou == 0 && sum/ten_thou==count){
                System.out.print(count+" 0 0");
                lie = false;
                break;
            }else{
            for(int y=0;y<count+1-x;y++){
                z = count - (x+y);
                        if((10000*x + 5000*y + 1000*z) == sum){
                            
                           System.out.print(x+" "+y+" "+z);
                           lie = false;
                            break;
                        }
            }
                } sum % ten_thou == 0 && sum/ten_thou==count sum % ten_thou == 0 sum % ten_thou sum ten_thou 0 sum/ten_thou==count sum/ten_thou sum ten_thou count {
                System.out.print(count+" 0 0");
                lie = false;
                break;
            } System.out.print(count+" 0 0") System.out.print System.out System System.out count+" 0 0" count " 0 0" lie = false lie false break; {
            for(int y=0;y<count+1-x;y++){
                z = count - (x+y);
                        if((10000*x + 5000*y + 1000*z) == sum){
                            
                           System.out.print(x+" "+y+" "+z);
                           lie = false;
                            break;
                        }
            }
                } for(int y=0;y<count+1-x;y++){
                z = count - (x+y);
                        if((10000*x + 5000*y + 1000*z) == sum){
                            
                           System.out.print(x+" "+y+" "+z);
                           lie = false;
                            break;
                        }
            } int y=0; int y=0; y 0 y<count+1-x y count+1-x count+1 count 1 x y++ y++ y {
                z = count - (x+y);
                        if((10000*x + 5000*y + 1000*z) == sum){
                            
                           System.out.print(x+" "+y+" "+z);
                           lie = false;
                            break;
                        }
            } {
                z = count - (x+y);
                        if((10000*x + 5000*y + 1000*z) == sum){
                            
                           System.out.print(x+" "+y+" "+z);
                           lie = false;
                            break;
                        }
            } z = count - (x+y) z count - (x+y) count (x+y) x y if((10000*x + 5000*y + 1000*z) == sum){
                            
                           System.out.print(x+" "+y+" "+z);
                           lie = false;
                            break;
                        } (10000*x + 5000*y + 1000*z) == sum (10000*x + 5000*y + 1000*z) 10000*x + 5000*y + 1000*z 10000*x 10000 x 5000*y 5000 y 1000*z 1000 z sum {
                            
                           System.out.print(x+" "+y+" "+z);
                           lie = false;
                            break;
                        } System.out.print(x+" "+y+" "+z) System.out.print System.out System System.out x+" "+y+" "+z " " y x+" "+y+" "+z x " " y " " z lie = false lie false break; if(!lie)break; !lie lie break; if(lie){
                    
                    System.out.print("-1 -1 -1");
                } lie {
                    
                    System.out.print("-1 -1 -1");
                } System.out.print("-1 -1 -1") System.out.print System.out System System.out "-1 -1 -1" String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);
        
        int count = scanner.nextInt();
        int sum = scanner.nextInt();
        int ten_thou = 10000;
        int five_thou = 5000;
        int thou = 1000;
        int z = 0;
        boolean lie = true;
        
        
        
        for(int x=0;x<count+1;x++){
            if(sum % ten_thou == 0 && sum/ten_thou==count){
                System.out.print(count+" 0 0");
                lie = false;
                break;
            }else{
            for(int y=0;y<count+1-x;y++){
                z = count - (x+y);
                        if((10000*x + 5000*y + 1000*z) == sum){
                            
                           System.out.print(x+" "+y+" "+z);
                           lie = false;
                            break;
                        }
            }
                }
                
                if(!lie)break;
                
            }
            
            if(lie){
                    
                    System.out.print("-1 -1 -1");
                }
            
        }
        
        
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);
        
        int count = scanner.nextInt();
        int sum = scanner.nextInt();
        int ten_thou = 10000;
        int five_thou = 5000;
        int thou = 1000;
        int z = 0;
        boolean lie = true;
        
        
        
        for(int x=0;x<count+1;x++){
            if(sum % ten_thou == 0 && sum/ten_thou==count){
                System.out.print(count+" 0 0");
                lie = false;
                break;
            }else{
            for(int y=0;y<count+1-x;y++){
                z = count - (x+y);
                        if((10000*x + 5000*y + 1000*z) == sum){
                            
                           System.out.print(x+" "+y+" "+z);
                           lie = false;
                            break;
                        }
            }
                }
                
                if(!lie)break;
                
            }
            
            if(lie){
                    
                    System.out.print("-1 -1 -1");
                }
            
        }
        
        
} Main
import java.util.*;
import java.util.Arrays;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);
        
        int count = scanner.nextInt();
        int sum = scanner.nextInt();
        int ten_thou = 10000;
        int five_thou = 5000;
        int thou = 1000;
        int z = 0;
        boolean lie = true;
        
        
        
        for(int x=0;x<count+1;x++){
            if(sum % ten_thou == 0 && sum/ten_thou==count){
                System.out.print(count+" 0 0");
                lie = false;
                break;
            }else{
            for(int y=0;y<count+1-x;y++){
                z = count - (x+y);
                        if((10000*x + 5000*y + 1000*z) == sum){
                            
                           System.out.print(x+" "+y+" "+z);
                           lie = false;
                            break;
                        }
            }
                }
                
                if(!lie)break;
                
            }
            
            if(lie){
                    
                    System.out.print("-1 -1 -1");
                }
            
        }
        
        
}