import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        String[] line = sc.nextLine().split(" ");

        int N = Integer.parseInt(line[0]);
        int Y = Integer.parseInt(line[1]);

        for(int x = 0;x <= N;x++){
            for(int y = 0;y <= N-x;y++){
                int z = N - x- y;

                if(z < 0){
                    continue;
                }
                
                int sum = 10000 * x + 5000 * y + 1000 * z;

                if(Y == sum){
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        }

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

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

    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        String[] line = sc.nextLine().split(" ");

        int N = Integer.parseInt(line[0]);
        int Y = Integer.parseInt(line[1]);

        for(int x = 0;x <= N;x++){
            for(int y = 0;y <= N-x;y++){
                int z = N - x- y;

                if(z < 0){
                    continue;
                }
                
                int sum = 10000 * x + 5000 * y + 1000 * z;

                if(Y == sum){
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        }

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

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

        Scanner sc = new Scanner(System.in);
        String[] line = sc.nextLine().split(" ");

        int N = Integer.parseInt(line[0]);
        int Y = Integer.parseInt(line[1]);

        for(int x = 0;x <= N;x++){
            for(int y = 0;y <= N-x;y++){
                int z = N - x- y;

                if(z < 0){
                    continue;
                }
                
                int sum = 10000 * x + 5000 * y + 1000 * z;

                if(Y == sum){
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        }

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

    } main {

        Scanner sc = new Scanner(System.in);
        String[] line = sc.nextLine().split(" ");

        int N = Integer.parseInt(line[0]);
        int Y = Integer.parseInt(line[1]);

        for(int x = 0;x <= N;x++){
            for(int y = 0;y <= N-x;y++){
                int z = N - x- y;

                if(z < 0){
                    continue;
                }
                
                int sum = 10000 * x + 5000 * y + 1000 * z;

                if(Y == sum){
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        }

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

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] line = sc.nextLine().split(" "); line sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int N = Integer.parseInt(line[0]); N Integer.parseInt(line[0]) Integer.parseInt Integer line[0] line 0 int Y = Integer.parseInt(line[1]); Y Integer.parseInt(line[1]) Integer.parseInt Integer line[1] line 1 for(int x = 0;x <= N;x++){
            for(int y = 0;y <= N-x;y++){
                int z = N - x- y;

                if(z < 0){
                    continue;
                }
                
                int sum = 10000 * x + 5000 * y + 1000 * z;

                if(Y == sum){
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        } 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(z < 0){
                    continue;
                }
                
                int sum = 10000 * x + 5000 * y + 1000 * z;

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

                if(z < 0){
                    continue;
                }
                
                int sum = 10000 * x + 5000 * y + 1000 * z;

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

                if(z < 0){
                    continue;
                }
                
                int sum = 10000 * x + 5000 * y + 1000 * z;

                if(Y == sum){
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            } 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(z < 0){
                    continue;
                }
                
                int sum = 10000 * x + 5000 * y + 1000 * z;

                if(Y == sum){
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            } {
                int z = N - x- y;

                if(z < 0){
                    continue;
                }
                
                int sum = 10000 * x + 5000 * y + 1000 * z;

                if(Y == sum){
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            } int z = N - x- y; z N - x- y N - x- y N x y if(z < 0){
                    continue;
                } z < 0 z 0 {
                    continue;
                } continue; int sum = 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 if(Y == sum){
                    System.out.println(x + " " + y + " " + z);
                    return;
                } Y == sum Y sum {
                    System.out.println(x + " " + y + " " + z);
                    return;
                } 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; 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) throws Exception {

        Scanner sc = new Scanner(System.in);
        String[] line = sc.nextLine().split(" ");

        int N = Integer.parseInt(line[0]);
        int Y = Integer.parseInt(line[1]);

        for(int x = 0;x <= N;x++){
            for(int y = 0;y <= N-x;y++){
                int z = N - x- y;

                if(z < 0){
                    continue;
                }
                
                int sum = 10000 * x + 5000 * y + 1000 * z;

                if(Y == sum){
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        }

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

    }
} public class Main {

    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        String[] line = sc.nextLine().split(" ");

        int N = Integer.parseInt(line[0]);
        int Y = Integer.parseInt(line[1]);

        for(int x = 0;x <= N;x++){
            for(int y = 0;y <= N-x;y++){
                int z = N - x- y;

                if(z < 0){
                    continue;
                }
                
                int sum = 10000 * x + 5000 * y + 1000 * z;

                if(Y == sum){
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        }

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

    }
} Main
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        String[] line = sc.nextLine().split(" ");

        int N = Integer.parseInt(line[0]);
        int Y = Integer.parseInt(line[1]);

        for(int x = 0;x <= N;x++){
            for(int y = 0;y <= N-x;y++){
                int z = N - x- y;

                if(z < 0){
                    continue;
                }
                
                int sum = 10000 * x + 5000 * y + 1000 * z;

                if(Y == sum){
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        }

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

    }
}
