import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            args = reader.readLine().split(" ");
            int N = Integer.parseInt(args[0]);
            int Y = Integer.parseInt(args[1]);

            for (int i = 0; i <= (Y / 10000); i++) {
                for (int j = 0; j <= ((Y - 10000 * i) / 5000); j++) {
                    int y = 10000 * i + 5000 * j + 1000 * (N - i - j);
                    if (y == Y) {
                        System.out.println(i + " " + j + " " + (N - i - j));
                        System.exit(0);
                    }
                }
            }

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

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            args = reader.readLine().split(" ");
            int N = Integer.parseInt(args[0]);
            int Y = Integer.parseInt(args[1]);

            for (int i = 0; i <= (Y / 10000); i++) {
                for (int j = 0; j <= ((Y - 10000 * i) / 5000); j++) {
                    int y = 10000 * i + 5000 * j + 1000 * (N - i - j);
                    if (y == Y) {
                        System.out.println(i + " " + j + " " + (N - i - j));
                        System.exit(0);
                    }
                }
            }

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

} Main public static void main(String[] args) throws Exception {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            args = reader.readLine().split(" ");
            int N = Integer.parseInt(args[0]);
            int Y = Integer.parseInt(args[1]);

            for (int i = 0; i <= (Y / 10000); i++) {
                for (int j = 0; j <= ((Y - 10000 * i) / 5000); j++) {
                    int y = 10000 * i + 5000 * j + 1000 * (N - i - j);
                    if (y == Y) {
                        System.out.println(i + " " + j + " " + (N - i - j));
                        System.exit(0);
                    }
                }
            }

            System.out.println("-1 -1 -1");
        }
    } main {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            args = reader.readLine().split(" ");
            int N = Integer.parseInt(args[0]);
            int Y = Integer.parseInt(args[1]);

            for (int i = 0; i <= (Y / 10000); i++) {
                for (int j = 0; j <= ((Y - 10000 * i) / 5000); j++) {
                    int y = 10000 * i + 5000 * j + 1000 * (N - i - j);
                    if (y == Y) {
                        System.out.println(i + " " + j + " " + (N - i - j));
                        System.exit(0);
                    }
                }
            }

            System.out.println("-1 -1 -1");
        }
    } try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            args = reader.readLine().split(" ");
            int N = Integer.parseInt(args[0]);
            int Y = Integer.parseInt(args[1]);

            for (int i = 0; i <= (Y / 10000); i++) {
                for (int j = 0; j <= ((Y - 10000 * i) / 5000); j++) {
                    int y = 10000 * i + 5000 * j + 1000 * (N - i - j);
                    if (y == Y) {
                        System.out.println(i + " " + j + " " + (N - i - j));
                        System.exit(0);
                    }
                }
            }

            System.out.println("-1 -1 -1");
        } {
            args = reader.readLine().split(" ");
            int N = Integer.parseInt(args[0]);
            int Y = Integer.parseInt(args[1]);

            for (int i = 0; i <= (Y / 10000); i++) {
                for (int j = 0; j <= ((Y - 10000 * i) / 5000); j++) {
                    int y = 10000 * i + 5000 * j + 1000 * (N - i - j);
                    if (y == Y) {
                        System.out.println(i + " " + j + " " + (N - i - j));
                        System.exit(0);
                    }
                }
            }

            System.out.println("-1 -1 -1");
        } BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)) BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)) new BufferedReader(new InputStreamReader(System.in)) args = reader.readLine().split(" ") args reader.readLine().split(" ") reader.readLine().split reader.readLine() reader.readLine reader " " int N = Integer.parseInt(args[0]); N Integer.parseInt(args[0]) Integer.parseInt Integer args[0] args 0 int Y = Integer.parseInt(args[1]); Y Integer.parseInt(args[1]) Integer.parseInt Integer args[1] args 1 for (int i = 0; i <= (Y / 10000); i++) {
                for (int j = 0; j <= ((Y - 10000 * i) / 5000); j++) {
                    int y = 10000 * i + 5000 * j + 1000 * (N - i - j);
                    if (y == Y) {
                        System.out.println(i + " " + j + " " + (N - i - j));
                        System.exit(0);
                    }
                }
            } int i = 0; int i = 0; i 0 i <= (Y / 10000) i (Y / 10000) Y 10000 i++ i++ i {
                for (int j = 0; j <= ((Y - 10000 * i) / 5000); j++) {
                    int y = 10000 * i + 5000 * j + 1000 * (N - i - j);
                    if (y == Y) {
                        System.out.println(i + " " + j + " " + (N - i - j));
                        System.exit(0);
                    }
                }
            } {
                for (int j = 0; j <= ((Y - 10000 * i) / 5000); j++) {
                    int y = 10000 * i + 5000 * j + 1000 * (N - i - j);
                    if (y == Y) {
                        System.out.println(i + " " + j + " " + (N - i - j));
                        System.exit(0);
                    }
                }
            } for (int j = 0; j <= ((Y - 10000 * i) / 5000); j++) {
                    int y = 10000 * i + 5000 * j + 1000 * (N - i - j);
                    if (y == Y) {
                        System.out.println(i + " " + j + " " + (N - i - j));
                        System.exit(0);
                    }
                } int j = 0; int j = 0; j 0 j <= ((Y - 10000 * i) / 5000) j ((Y - 10000 * i) / 5000) (Y - 10000 * i) Y 10000 * i 10000 i 5000 j++ j++ j {
                    int y = 10000 * i + 5000 * j + 1000 * (N - i - j);
                    if (y == Y) {
                        System.out.println(i + " " + j + " " + (N - i - j));
                        System.exit(0);
                    }
                } {
                    int y = 10000 * i + 5000 * j + 1000 * (N - i - j);
                    if (y == Y) {
                        System.out.println(i + " " + j + " " + (N - i - j));
                        System.exit(0);
                    }
                } int y = 10000 * i + 5000 * j + 1000 * (N - i - j); y 10000 * i + 5000 * j + 1000 * (N - i - j) 10000 * i + 5000 * j + 1000 * (N - i - j) 10000 * i 10000 i 5000 * j 5000 j 1000 * (N - i - j) 1000 (N - i - j) N - i - j N i j if (y == Y) {
                        System.out.println(i + " " + j + " " + (N - i - j));
                        System.exit(0);
                    } y == Y y Y {
                        System.out.println(i + " " + j + " " + (N - i - j));
                        System.exit(0);
                    } System.out.println(i + " " + j + " " + (N - i - j)) System.out.println System.out System System.out i + " " + j + " " + (N - i - j) " " j i + " " + j + " " + (N - i - j) i " " j " " (N - i - j) N - i - j N i j System.exit(0) System.exit System 0 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 {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            args = reader.readLine().split(" ");
            int N = Integer.parseInt(args[0]);
            int Y = Integer.parseInt(args[1]);

            for (int i = 0; i <= (Y / 10000); i++) {
                for (int j = 0; j <= ((Y - 10000 * i) / 5000); j++) {
                    int y = 10000 * i + 5000 * j + 1000 * (N - i - j);
                    if (y == Y) {
                        System.out.println(i + " " + j + " " + (N - i - j));
                        System.exit(0);
                    }
                }
            }

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

} public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            args = reader.readLine().split(" ");
            int N = Integer.parseInt(args[0]);
            int Y = Integer.parseInt(args[1]);

            for (int i = 0; i <= (Y / 10000); i++) {
                for (int j = 0; j <= ((Y - 10000 * i) / 5000); j++) {
                    int y = 10000 * i + 5000 * j + 1000 * (N - i - j);
                    if (y == Y) {
                        System.out.println(i + " " + j + " " + (N - i - j));
                        System.exit(0);
                    }
                }
            }

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

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            args = reader.readLine().split(" ");
            int N = Integer.parseInt(args[0]);
            int Y = Integer.parseInt(args[1]);

            for (int i = 0; i <= (Y / 10000); i++) {
                for (int j = 0; j <= ((Y - 10000 * i) / 5000); j++) {
                    int y = 10000 * i + 5000 * j + 1000 * (N - i - j);
                    if (y == Y) {
                        System.out.println(i + " " + j + " " + (N - i - j));
                        System.exit(0);
                    }
                }
            }

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

}
