import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        int Bills = scn.nextInt();
        int Sum = scn.nextInt();

        if(Check(Sum, Bills) == 1){
            System.out.println("-1 -1 -1");
        }
    }

    public static int Check(int Y, int N){

        for(int x=0; x<=N; x++){
            for(int y=0; y<=N-x; y++){
                int z = N-x-y;
                if(x*10000 + y*5000 + z*1000 == Y){
                    System.out.println(x + " " + " " + y + " " +z);
                    return 0;
                }
            }
        }
        return 1;
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        int Bills = scn.nextInt();
        int Sum = scn.nextInt();

        if(Check(Sum, Bills) == 1){
            System.out.println("-1 -1 -1");
        }
    }

    public static int Check(int Y, int N){

        for(int x=0; x<=N; x++){
            for(int y=0; y<=N-x; y++){
                int z = N-x-y;
                if(x*10000 + y*5000 + z*1000 == Y){
                    System.out.println(x + " " + " " + y + " " +z);
                    return 0;
                }
            }
        }
        return 1;
    }
} Main public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        int Bills = scn.nextInt();
        int Sum = scn.nextInt();

        if(Check(Sum, Bills) == 1){
            System.out.println("-1 -1 -1");
        }
    } main {
        Scanner scn = new Scanner(System.in);
        int Bills = scn.nextInt();
        int Sum = scn.nextInt();

        if(Check(Sum, Bills) == 1){
            System.out.println("-1 -1 -1");
        }
    } Scanner scn = new Scanner(System.in); scn new Scanner(System.in) int Bills = scn.nextInt(); Bills scn.nextInt() scn.nextInt scn int Sum = scn.nextInt(); Sum scn.nextInt() scn.nextInt scn if(Check(Sum, Bills) == 1){
            System.out.println("-1 -1 -1");
        } Check(Sum, Bills) == 1 Check(Sum, Bills) Check Sum Bills 1 {
            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 static int Check(int Y, int N){

        for(int x=0; x<=N; x++){
            for(int y=0; y<=N-x; y++){
                int z = N-x-y;
                if(x*10000 + y*5000 + z*1000 == Y){
                    System.out.println(x + " " + " " + y + " " +z);
                    return 0;
                }
            }
        }
        return 1;
    } Check {

        for(int x=0; x<=N; x++){
            for(int y=0; y<=N-x; y++){
                int z = N-x-y;
                if(x*10000 + y*5000 + z*1000 == Y){
                    System.out.println(x + " " + " " + y + " " +z);
                    return 0;
                }
            }
        }
        return 1;
    } for(int x=0; x<=N; x++){
            for(int y=0; y<=N-x; y++){
                int z = N-x-y;
                if(x*10000 + y*5000 + z*1000 == Y){
                    System.out.println(x + " " + " " + y + " " +z);
                    return 0;
                }
            }
        } int x=0; int x=0; x 0 x<=N x N x++ x++ x {
            for(int y=0; y<=N-x; y++){
                int z = N-x-y;
                if(x*10000 + y*5000 + z*1000 == Y){
                    System.out.println(x + " " + " " + y + " " +z);
                    return 0;
                }
            }
        } {
            for(int y=0; y<=N-x; y++){
                int z = N-x-y;
                if(x*10000 + y*5000 + z*1000 == Y){
                    System.out.println(x + " " + " " + y + " " +z);
                    return 0;
                }
            }
        } for(int y=0; y<=N-x; y++){
                int z = N-x-y;
                if(x*10000 + y*5000 + z*1000 == Y){
                    System.out.println(x + " " + " " + y + " " +z);
                    return 0;
                }
            } int y=0; int y=0; y 0 y<=N-x y N-x N x y++ y++ y {
                int z = N-x-y;
                if(x*10000 + y*5000 + z*1000 == Y){
                    System.out.println(x + " " + " " + y + " " +z);
                    return 0;
                }
            } {
                int z = N-x-y;
                if(x*10000 + y*5000 + z*1000 == Y){
                    System.out.println(x + " " + " " + y + " " +z);
                    return 0;
                }
            } int z = N-x-y; z N-x-y N-x-y N x y if(x*10000 + y*5000 + z*1000 == Y){
                    System.out.println(x + " " + " " + y + " " +z);
                    return 0;
                } x*10000 + y*5000 + z*1000 == Y x*10000 + y*5000 + z*1000 x*10000 + y*5000 + z*1000 x*10000 x 10000 y*5000 y 5000 z*1000 z 1000 Y {
                    System.out.println(x + " " + " " + y + " " +z);
                    return 0;
                } System.out.println(x + " " + " " + y + " " +z) System.out.println System.out System System.out x + " " + " " + y + " " +z " " y " " x + " " + " " + y + " " +z x " " " " y " " z return 0; 0 return 1; 1 int Y Y int N N public class Main{
    public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        int Bills = scn.nextInt();
        int Sum = scn.nextInt();

        if(Check(Sum, Bills) == 1){
            System.out.println("-1 -1 -1");
        }
    }

    public static int Check(int Y, int N){

        for(int x=0; x<=N; x++){
            for(int y=0; y<=N-x; y++){
                int z = N-x-y;
                if(x*10000 + y*5000 + z*1000 == Y){
                    System.out.println(x + " " + " " + y + " " +z);
                    return 0;
                }
            }
        }
        return 1;
    }
} public class Main{
    public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        int Bills = scn.nextInt();
        int Sum = scn.nextInt();

        if(Check(Sum, Bills) == 1){
            System.out.println("-1 -1 -1");
        }
    }

    public static int Check(int Y, int N){

        for(int x=0; x<=N; x++){
            for(int y=0; y<=N-x; y++){
                int z = N-x-y;
                if(x*10000 + y*5000 + z*1000 == Y){
                    System.out.println(x + " " + " " + y + " " +z);
                    return 0;
                }
            }
        }
        return 1;
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        int Bills = scn.nextInt();
        int Sum = scn.nextInt();

        if(Check(Sum, Bills) == 1){
            System.out.println("-1 -1 -1");
        }
    }

    public static int Check(int Y, int N){

        for(int x=0; x<=N; x++){
            for(int y=0; y<=N-x; y++){
                int z = N-x-y;
                if(x*10000 + y*5000 + z*1000 == Y){
                    System.out.println(x + " " + " " + y + " " +z);
                    return 0;
                }
            }
        }
        return 1;
    }
}