import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int Y = in.nextInt();

            for (int _1e4 = 0; _1e4 <= N; _1e4++) {
                for (int _5e3 = 0; _1e4 + _5e3 <= N; _5e3++) {
                    int _1e3 = N - (_1e4 + _5e3);
                    if (_1e4 * 10000 + _5e3 * 5000 + _1e3 * 1000 == Y) {
                        System.out.println(_1e4 + " " + _5e3 + " " + _1e3);
                        return;
                    }
                }
            }

            System.out.println("-1 -1 -1");
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int Y = in.nextInt();

            for (int _1e4 = 0; _1e4 <= N; _1e4++) {
                for (int _5e3 = 0; _1e4 + _5e3 <= N; _5e3++) {
                    int _1e3 = N - (_1e4 + _5e3);
                    if (_1e4 * 10000 + _5e3 * 5000 + _1e3 * 1000 == Y) {
                        System.out.println(_1e4 + " " + _5e3 + " " + _1e3);
                        return;
                    }
                }
            }

            System.out.println("-1 -1 -1");
        }
    }
} Main public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int Y = in.nextInt();

            for (int _1e4 = 0; _1e4 <= N; _1e4++) {
                for (int _5e3 = 0; _1e4 + _5e3 <= N; _5e3++) {
                    int _1e3 = N - (_1e4 + _5e3);
                    if (_1e4 * 10000 + _5e3 * 5000 + _1e3 * 1000 == Y) {
                        System.out.println(_1e4 + " " + _5e3 + " " + _1e3);
                        return;
                    }
                }
            }

            System.out.println("-1 -1 -1");
        }
    } main {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int Y = in.nextInt();

            for (int _1e4 = 0; _1e4 <= N; _1e4++) {
                for (int _5e3 = 0; _1e4 + _5e3 <= N; _5e3++) {
                    int _1e3 = N - (_1e4 + _5e3);
                    if (_1e4 * 10000 + _5e3 * 5000 + _1e3 * 1000 == Y) {
                        System.out.println(_1e4 + " " + _5e3 + " " + _1e3);
                        return;
                    }
                }
            }

            System.out.println("-1 -1 -1");
        }
    } try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int Y = in.nextInt();

            for (int _1e4 = 0; _1e4 <= N; _1e4++) {
                for (int _5e3 = 0; _1e4 + _5e3 <= N; _5e3++) {
                    int _1e3 = N - (_1e4 + _5e3);
                    if (_1e4 * 10000 + _5e3 * 5000 + _1e3 * 1000 == Y) {
                        System.out.println(_1e4 + " " + _5e3 + " " + _1e3);
                        return;
                    }
                }
            }

            System.out.println("-1 -1 -1");
        } {
            int N = in.nextInt();
            int Y = in.nextInt();

            for (int _1e4 = 0; _1e4 <= N; _1e4++) {
                for (int _5e3 = 0; _1e4 + _5e3 <= N; _5e3++) {
                    int _1e3 = N - (_1e4 + _5e3);
                    if (_1e4 * 10000 + _5e3 * 5000 + _1e3 * 1000 == Y) {
                        System.out.println(_1e4 + " " + _5e3 + " " + _1e3);
                        return;
                    }
                }
            }

            System.out.println("-1 -1 -1");
        } Scanner in = new Scanner(System.in) Scanner in = new Scanner(System.in) new Scanner(System.in) int N = in.nextInt(); N in.nextInt() in.nextInt in int Y = in.nextInt(); Y in.nextInt() in.nextInt in for (int _1e4 = 0; _1e4 <= N; _1e4++) {
                for (int _5e3 = 0; _1e4 + _5e3 <= N; _5e3++) {
                    int _1e3 = N - (_1e4 + _5e3);
                    if (_1e4 * 10000 + _5e3 * 5000 + _1e3 * 1000 == Y) {
                        System.out.println(_1e4 + " " + _5e3 + " " + _1e3);
                        return;
                    }
                }
            } int _1e4 = 0; int _1e4 = 0; _1e4 0 _1e4 <= N _1e4 N _1e4++ _1e4++ _1e4 {
                for (int _5e3 = 0; _1e4 + _5e3 <= N; _5e3++) {
                    int _1e3 = N - (_1e4 + _5e3);
                    if (_1e4 * 10000 + _5e3 * 5000 + _1e3 * 1000 == Y) {
                        System.out.println(_1e4 + " " + _5e3 + " " + _1e3);
                        return;
                    }
                }
            } {
                for (int _5e3 = 0; _1e4 + _5e3 <= N; _5e3++) {
                    int _1e3 = N - (_1e4 + _5e3);
                    if (_1e4 * 10000 + _5e3 * 5000 + _1e3 * 1000 == Y) {
                        System.out.println(_1e4 + " " + _5e3 + " " + _1e3);
                        return;
                    }
                }
            } for (int _5e3 = 0; _1e4 + _5e3 <= N; _5e3++) {
                    int _1e3 = N - (_1e4 + _5e3);
                    if (_1e4 * 10000 + _5e3 * 5000 + _1e3 * 1000 == Y) {
                        System.out.println(_1e4 + " " + _5e3 + " " + _1e3);
                        return;
                    }
                } int _5e3 = 0; int _5e3 = 0; _5e3 0 _1e4 + _5e3 <= N _1e4 + _5e3 _1e4 _5e3 N _5e3++ _5e3++ _5e3 {
                    int _1e3 = N - (_1e4 + _5e3);
                    if (_1e4 * 10000 + _5e3 * 5000 + _1e3 * 1000 == Y) {
                        System.out.println(_1e4 + " " + _5e3 + " " + _1e3);
                        return;
                    }
                } {
                    int _1e3 = N - (_1e4 + _5e3);
                    if (_1e4 * 10000 + _5e3 * 5000 + _1e3 * 1000 == Y) {
                        System.out.println(_1e4 + " " + _5e3 + " " + _1e3);
                        return;
                    }
                } int _1e3 = N - (_1e4 + _5e3); _1e3 N - (_1e4 + _5e3) N (_1e4 + _5e3) _1e4 _5e3 if (_1e4 * 10000 + _5e3 * 5000 + _1e3 * 1000 == Y) {
                        System.out.println(_1e4 + " " + _5e3 + " " + _1e3);
                        return;
                    } _1e4 * 10000 + _5e3 * 5000 + _1e3 * 1000 == Y _1e4 * 10000 + _5e3 * 5000 + _1e3 * 1000 _1e4 * 10000 + _5e3 * 5000 + _1e3 * 1000 _1e4 * 10000 _1e4 10000 _5e3 * 5000 _5e3 5000 _1e3 * 1000 _1e3 1000 Y {
                        System.out.println(_1e4 + " " + _5e3 + " " + _1e3);
                        return;
                    } System.out.println(_1e4 + " " + _5e3 + " " + _1e3) System.out.println System.out System System.out _1e4 + " " + _5e3 + " " + _1e3 " " _5e3 _1e4 + " " + _5e3 + " " + _1e3 _1e4 " " _5e3 " " _1e3 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) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int Y = in.nextInt();

            for (int _1e4 = 0; _1e4 <= N; _1e4++) {
                for (int _5e3 = 0; _1e4 + _5e3 <= N; _5e3++) {
                    int _1e3 = N - (_1e4 + _5e3);
                    if (_1e4 * 10000 + _5e3 * 5000 + _1e3 * 1000 == Y) {
                        System.out.println(_1e4 + " " + _5e3 + " " + _1e3);
                        return;
                    }
                }
            }

            System.out.println("-1 -1 -1");
        }
    }
} public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int Y = in.nextInt();

            for (int _1e4 = 0; _1e4 <= N; _1e4++) {
                for (int _5e3 = 0; _1e4 + _5e3 <= N; _5e3++) {
                    int _1e3 = N - (_1e4 + _5e3);
                    if (_1e4 * 10000 + _5e3 * 5000 + _1e3 * 1000 == Y) {
                        System.out.println(_1e4 + " " + _5e3 + " " + _1e3);
                        return;
                    }
                }
            }

            System.out.println("-1 -1 -1");
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int Y = in.nextInt();

            for (int _1e4 = 0; _1e4 <= N; _1e4++) {
                for (int _5e3 = 0; _1e4 + _5e3 <= N; _5e3++) {
                    int _1e3 = N - (_1e4 + _5e3);
                    if (_1e4 * 10000 + _5e3 * 5000 + _1e3 * 1000 == Y) {
                        System.out.println(_1e4 + " " + _5e3 + " " + _1e3);
                        return;
                    }
                }
            }

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