import java.util.*;

class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        // 入力されるお札枚数
        int N = sc.nextInt();
        // 入力される金額
        int Y = sc.nextInt();


            for(int i = 0; i <= N; i++) {
        
                for (int j = 0; j <= N - i; j++) {

                    int z = N - i - j;
                    
                    int ans = i * 10000 + j * 5000 + z * 1000;
                    
                    if(ans == Y) {
                        System.out.println(i + " " + j + " " + z);
                        return;
                    }

                }
             }

             System.out.println("-1 -1 -1");
                
            sc.close();

        }

    }
 import java.util.*; util.* java class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        // 入力されるお札枚数
        int N = sc.nextInt();
        // 入力される金額
        int Y = sc.nextInt();


            for(int i = 0; i <= N; i++) {
        
                for (int j = 0; j <= N - i; j++) {

                    int z = N - i - j;
                    
                    int ans = i * 10000 + j * 5000 + z * 1000;
                    
                    if(ans == Y) {
                        System.out.println(i + " " + j + " " + z);
                        return;
                    }

                }
             }

             System.out.println("-1 -1 -1");
                
            sc.close();

        }

    } Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        // 入力されるお札枚数
        int N = sc.nextInt();
        // 入力される金額
        int Y = sc.nextInt();


            for(int i = 0; i <= N; i++) {
        
                for (int j = 0; j <= N - i; j++) {

                    int z = N - i - j;
                    
                    int ans = i * 10000 + j * 5000 + z * 1000;
                    
                    if(ans == Y) {
                        System.out.println(i + " " + j + " " + z);
                        return;
                    }

                }
             }

             System.out.println("-1 -1 -1");
                
            sc.close();

        } main {

        Scanner sc = new Scanner(System.in);
        // 入力されるお札枚数
        int N = sc.nextInt();
        // 入力される金額
        int Y = sc.nextInt();


            for(int i = 0; i <= N; i++) {
        
                for (int j = 0; j <= N - i; j++) {

                    int z = N - i - j;
                    
                    int ans = i * 10000 + j * 5000 + z * 1000;
                    
                    if(ans == Y) {
                        System.out.println(i + " " + j + " " + z);
                        return;
                    }

                }
             }

             System.out.println("-1 -1 -1");
                
            sc.close();

        } 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 for(int i = 0; i <= N; i++) {
        
                for (int j = 0; j <= N - i; j++) {

                    int z = N - i - j;
                    
                    int ans = i * 10000 + j * 5000 + z * 1000;
                    
                    if(ans == Y) {
                        System.out.println(i + " " + j + " " + z);
                        return;
                    }

                }
             } int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
        
                for (int j = 0; j <= N - i; j++) {

                    int z = N - i - j;
                    
                    int ans = i * 10000 + j * 5000 + z * 1000;
                    
                    if(ans == Y) {
                        System.out.println(i + " " + j + " " + z);
                        return;
                    }

                }
             } {
        
                for (int j = 0; j <= N - i; j++) {

                    int z = N - i - j;
                    
                    int ans = i * 10000 + j * 5000 + z * 1000;
                    
                    if(ans == Y) {
                        System.out.println(i + " " + j + " " + z);
                        return;
                    }

                }
             } for (int j = 0; j <= N - i; j++) {

                    int z = N - i - j;
                    
                    int ans = i * 10000 + j * 5000 + z * 1000;
                    
                    if(ans == Y) {
                        System.out.println(i + " " + j + " " + z);
                        return;
                    }

                } int j = 0; int j = 0; j 0 j <= N - i j N - i N i j++ j++ j {

                    int z = N - i - j;
                    
                    int ans = i * 10000 + j * 5000 + z * 1000;
                    
                    if(ans == Y) {
                        System.out.println(i + " " + j + " " + z);
                        return;
                    }

                } {

                    int z = N - i - j;
                    
                    int ans = i * 10000 + j * 5000 + z * 1000;
                    
                    if(ans == Y) {
                        System.out.println(i + " " + j + " " + z);
                        return;
                    }

                } int z = N - i - j; z N - i - j N - i - j N i j int ans = i * 10000 + j * 5000 + z * 1000; ans i * 10000 + j * 5000 + z * 1000 i * 10000 + j * 5000 + z * 1000 i * 10000 i 10000 j * 5000 j 5000 z * 1000 z 1000 if(ans == Y) {
                        System.out.println(i + " " + j + " " + z);
                        return;
                    } ans == Y ans Y {
                        System.out.println(i + " " + j + " " + z);
                        return;
                    } System.out.println(i + " " + j + " " + z) System.out.println System.out System System.out i + " " + j + " " + z " " j i + " " + j + " " + z i " " j " " z return; System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" sc.close() sc.close sc String[] args args
import java.util.*;

class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        // 入力されるお札枚数
        int N = sc.nextInt();
        // 入力される金額
        int Y = sc.nextInt();


            for(int i = 0; i <= N; i++) {
        
                for (int j = 0; j <= N - i; j++) {

                    int z = N - i - j;
                    
                    int ans = i * 10000 + j * 5000 + z * 1000;
                    
                    if(ans == Y) {
                        System.out.println(i + " " + j + " " + z);
                        return;
                    }

                }
             }

             System.out.println("-1 -1 -1");
                
            sc.close();

        }

    }

