import java.util.Scanner;
public class Main {
    public static void main(String args[]) {
        int N, Y;
        Scanner scanner = new Scanner(System.in);
        N = scanner.nextInt();
        Y = scanner.nextInt();
        int x, y, z = 0;

        boolean check = false;
        for (x = 0; x <= N; x++) {
            for (y = 0; y <= N - x; y++) {
                z = N - x - y;
                if (Y == x * 10000 + y * 5000 + z * 1000) {
                    System.out.println(x+" "+y+" "+z);
                    check = true;
                }
               if (check == true){
                   break;
               }
            }
            if(check == true) {
                break;
            }
        }
        if(check == false){
            System.out.println("-1 -1 -1");
        }

    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String args[]) {
        int N, Y;
        Scanner scanner = new Scanner(System.in);
        N = scanner.nextInt();
        Y = scanner.nextInt();
        int x, y, z = 0;

        boolean check = false;
        for (x = 0; x <= N; x++) {
            for (y = 0; y <= N - x; y++) {
                z = N - x - y;
                if (Y == x * 10000 + y * 5000 + z * 1000) {
                    System.out.println(x+" "+y+" "+z);
                    check = true;
                }
               if (check == true){
                   break;
               }
            }
            if(check == true) {
                break;
            }
        }
        if(check == false){
            System.out.println("-1 -1 -1");
        }

    }
} Main public static void main(String args[]) {
        int N, Y;
        Scanner scanner = new Scanner(System.in);
        N = scanner.nextInt();
        Y = scanner.nextInt();
        int x, y, z = 0;

        boolean check = false;
        for (x = 0; x <= N; x++) {
            for (y = 0; y <= N - x; y++) {
                z = N - x - y;
                if (Y == x * 10000 + y * 5000 + z * 1000) {
                    System.out.println(x+" "+y+" "+z);
                    check = true;
                }
               if (check == true){
                   break;
               }
            }
            if(check == true) {
                break;
            }
        }
        if(check == false){
            System.out.println("-1 -1 -1");
        }

    } main {
        int N, Y;
        Scanner scanner = new Scanner(System.in);
        N = scanner.nextInt();
        Y = scanner.nextInt();
        int x, y, z = 0;

        boolean check = false;
        for (x = 0; x <= N; x++) {
            for (y = 0; y <= N - x; y++) {
                z = N - x - y;
                if (Y == x * 10000 + y * 5000 + z * 1000) {
                    System.out.println(x+" "+y+" "+z);
                    check = true;
                }
               if (check == true){
                   break;
               }
            }
            if(check == true) {
                break;
            }
        }
        if(check == false){
            System.out.println("-1 -1 -1");
        }

    } int N N Y; Y Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) N = scanner.nextInt() N scanner.nextInt() scanner.nextInt scanner Y = scanner.nextInt() Y scanner.nextInt() scanner.nextInt scanner int x x y y z = 0; z 0 boolean check = false; check false for (x = 0; x <= N; x++) {
            for (y = 0; y <= N - x; y++) {
                z = N - x - y;
                if (Y == x * 10000 + y * 5000 + z * 1000) {
                    System.out.println(x+" "+y+" "+z);
                    check = true;
                }
               if (check == true){
                   break;
               }
            }
            if(check == true) {
                break;
            }
        } x = 0; x = 0 x 0 x <= N x N x++ x++ x {
            for (y = 0; y <= N - x; y++) {
                z = N - x - y;
                if (Y == x * 10000 + y * 5000 + z * 1000) {
                    System.out.println(x+" "+y+" "+z);
                    check = true;
                }
               if (check == true){
                   break;
               }
            }
            if(check == true) {
                break;
            }
        } {
            for (y = 0; y <= N - x; y++) {
                z = N - x - y;
                if (Y == x * 10000 + y * 5000 + z * 1000) {
                    System.out.println(x+" "+y+" "+z);
                    check = true;
                }
               if (check == true){
                   break;
               }
            }
            if(check == true) {
                break;
            }
        } for (y = 0; y <= N - x; y++) {
                z = N - x - y;
                if (Y == x * 10000 + y * 5000 + z * 1000) {
                    System.out.println(x+" "+y+" "+z);
                    check = true;
                }
               if (check == true){
                   break;
               }
            } y = 0; y = 0 y 0 y <= N - x y N - x N x y++ y++ y {
                z = N - x - y;
                if (Y == x * 10000 + y * 5000 + z * 1000) {
                    System.out.println(x+" "+y+" "+z);
                    check = true;
                }
               if (check == true){
                   break;
               }
            } {
                z = N - x - y;
                if (Y == x * 10000 + y * 5000 + z * 1000) {
                    System.out.println(x+" "+y+" "+z);
                    check = true;
                }
               if (check == true){
                   break;
               }
            } z = N - x - y z N - x - y N - x - y N x y if (Y == x * 10000 + y * 5000 + z * 1000) {
                    System.out.println(x+" "+y+" "+z);
                    check = true;
                } Y == 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 {
                    System.out.println(x+" "+y+" "+z);
                    check = true;
                } System.out.println(x+" "+y+" "+z) System.out.println System.out System System.out x+" "+y+" "+z " " y x+" "+y+" "+z x " " y " " z check = true check true if (check == true){
                   break;
               } check == true check true {
                   break;
               } break; if(check == true) {
                break;
            } check == true check true {
                break;
            } break; if(check == false){
            System.out.println("-1 -1 -1");
        } check == false check 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[]) {
        int N, Y;
        Scanner scanner = new Scanner(System.in);
        N = scanner.nextInt();
        Y = scanner.nextInt();
        int x, y, z = 0;

        boolean check = false;
        for (x = 0; x <= N; x++) {
            for (y = 0; y <= N - x; y++) {
                z = N - x - y;
                if (Y == x * 10000 + y * 5000 + z * 1000) {
                    System.out.println(x+" "+y+" "+z);
                    check = true;
                }
               if (check == true){
                   break;
               }
            }
            if(check == true) {
                break;
            }
        }
        if(check == false){
            System.out.println("-1 -1 -1");
        }

    }
} public class Main {
    public static void main(String args[]) {
        int N, Y;
        Scanner scanner = new Scanner(System.in);
        N = scanner.nextInt();
        Y = scanner.nextInt();
        int x, y, z = 0;

        boolean check = false;
        for (x = 0; x <= N; x++) {
            for (y = 0; y <= N - x; y++) {
                z = N - x - y;
                if (Y == x * 10000 + y * 5000 + z * 1000) {
                    System.out.println(x+" "+y+" "+z);
                    check = true;
                }
               if (check == true){
                   break;
               }
            }
            if(check == true) {
                break;
            }
        }
        if(check == false){
            System.out.println("-1 -1 -1");
        }

    }
} Main
import java.util.Scanner;
public class Main {
    public static void main(String args[]) {
        int N, Y;
        Scanner scanner = new Scanner(System.in);
        N = scanner.nextInt();
        Y = scanner.nextInt();
        int x, y, z = 0;

        boolean check = false;
        for (x = 0; x <= N; x++) {
            for (y = 0; y <= N - x; y++) {
                z = N - x - y;
                if (Y == x * 10000 + y * 5000 + z * 1000) {
                    System.out.println(x+" "+y+" "+z);
                    check = true;
                }
               if (check == true){
                   break;
               }
            }
            if(check == true) {
                break;
            }
        }
        if(check == false){
            System.out.println("-1 -1 -1");
        }

    }
}
