import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Otoshidama solver = new Otoshidama();
        solver.solve(1, in, out);
        out.close();
    }

    static class Otoshidama {
        int n;
        long y;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            n = in.nextInt();
            y = in.nextLong();
            for (int i = 0; i <= n; i++) {
                // 10,000
                for (int j = 0; i + j <= n; j++) {
                    // 5,000

                    int k = n - i - j;
                    if (y == calc(i, j, k)) {
                        out.println(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            }
            out.println(String.format("%d %d %d", -1, -1, -1));
        }

        private int calc(int x, int y, int z) {
            return 10000 * x + 5000 * y + 1000 * z;
        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Otoshidama solver = new Otoshidama();
        solver.solve(1, in, out);
        out.close();
    }

    static class Otoshidama {
        int n;
        long y;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            n = in.nextInt();
            y = in.nextLong();
            for (int i = 0; i <= n; i++) {
                // 10,000
                for (int j = 0; i + j <= n; j++) {
                    // 5,000

                    int k = n - i - j;
                    if (y == calc(i, j, k)) {
                        out.println(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            }
            out.println(String.format("%d %d %d", -1, -1, -1));
        }

        private int calc(int x, int y, int z) {
            return 10000 * x + 5000 * y + 1000 * z;
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Otoshidama solver = new Otoshidama();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Otoshidama solver = new Otoshidama();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) Otoshidama solver = new Otoshidama(); solver new Otoshidama() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class Otoshidama {
        int n;
        long y;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            n = in.nextInt();
            y = in.nextLong();
            for (int i = 0; i <= n; i++) {
                // 10,000
                for (int j = 0; i + j <= n; j++) {
                    // 5,000

                    int k = n - i - j;
                    if (y == calc(i, j, k)) {
                        out.println(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            }
            out.println(String.format("%d %d %d", -1, -1, -1));
        }

        private int calc(int x, int y, int z) {
            return 10000 * x + 5000 * y + 1000 * z;
        }

    } Otoshidama int n; n long y; y public void solve(int testNumber, Scanner in, PrintWriter out) {
            n = in.nextInt();
            y = in.nextLong();
            for (int i = 0; i <= n; i++) {
                // 10,000
                for (int j = 0; i + j <= n; j++) {
                    // 5,000

                    int k = n - i - j;
                    if (y == calc(i, j, k)) {
                        out.println(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            }
            out.println(String.format("%d %d %d", -1, -1, -1));
        } solve {
            n = in.nextInt();
            y = in.nextLong();
            for (int i = 0; i <= n; i++) {
                // 10,000
                for (int j = 0; i + j <= n; j++) {
                    // 5,000

                    int k = n - i - j;
                    if (y == calc(i, j, k)) {
                        out.println(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            }
            out.println(String.format("%d %d %d", -1, -1, -1));
        } n = in.nextInt() n in.nextInt() in.nextInt in y = in.nextLong() y in.nextLong() in.nextLong in for (int i = 0; i <= n; i++) {
                // 10,000
                for (int j = 0; i + j <= n; j++) {
                    // 5,000

                    int k = n - i - j;
                    if (y == calc(i, j, k)) {
                        out.println(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            } int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
                // 10,000
                for (int j = 0; i + j <= n; j++) {
                    // 5,000

                    int k = n - i - j;
                    if (y == calc(i, j, k)) {
                        out.println(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            } {
                // 10,000
                for (int j = 0; i + j <= n; j++) {
                    // 5,000

                    int k = n - i - j;
                    if (y == calc(i, j, k)) {
                        out.println(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            } for (int j = 0; i + j <= n; j++) {
                    // 5,000

                    int k = n - i - j;
                    if (y == calc(i, j, k)) {
                        out.println(String.format("%d %d %d", i, j, k));
                        return;
                    }
                } int j = 0; int j = 0; j 0 i + j <= n i + j i j n j++ j++ j {
                    // 5,000

                    int k = n - i - j;
                    if (y == calc(i, j, k)) {
                        out.println(String.format("%d %d %d", i, j, k));
                        return;
                    }
                } {
                    // 5,000

                    int k = n - i - j;
                    if (y == calc(i, j, k)) {
                        out.println(String.format("%d %d %d", i, j, k));
                        return;
                    }
                } int k = n - i - j; k n - i - j n - i - j n i j if (y == calc(i, j, k)) {
                        out.println(String.format("%d %d %d", i, j, k));
                        return;
                    } y == calc(i, j, k) y calc(i, j, k) calc i j k {
                        out.println(String.format("%d %d %d", i, j, k));
                        return;
                    } out.println(String.format("%d %d %d", i, j, k)) out.println out String.format("%d %d %d", i, j, k) String.format String "%d %d %d" i j k return; out.println(String.format("%d %d %d", -1, -1, -1)) out.println out String.format("%d %d %d", -1, -1, -1) String.format String "%d %d %d" -1 1 -1 1 -1 1 int testNumber testNumber Scanner in in PrintWriter out out private int calc(int x, int y, int z) {
            return 10000 * x + 5000 * y + 1000 * z;
        } calc {
            return 10000 * x + 5000 * y + 1000 * z;
        } return 10000 * x + 5000 * y + 1000 * z; 10000 * x + 5000 * y + 1000 * z 10000 * x + 5000 * y + 1000 * z 10000 * x 10000 x 5000 * y 5000 y 1000 * z 1000 z int x x int y y int z z public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Otoshidama solver = new Otoshidama();
        solver.solve(1, in, out);
        out.close();
    }

    static class Otoshidama {
        int n;
        long y;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            n = in.nextInt();
            y = in.nextLong();
            for (int i = 0; i <= n; i++) {
                // 10,000
                for (int j = 0; i + j <= n; j++) {
                    // 5,000

                    int k = n - i - j;
                    if (y == calc(i, j, k)) {
                        out.println(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            }
            out.println(String.format("%d %d %d", -1, -1, -1));
        }

        private int calc(int x, int y, int z) {
            return 10000 * x + 5000 * y + 1000 * z;
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Otoshidama solver = new Otoshidama();
        solver.solve(1, in, out);
        out.close();
    }

    static class Otoshidama {
        int n;
        long y;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            n = in.nextInt();
            y = in.nextLong();
            for (int i = 0; i <= n; i++) {
                // 10,000
                for (int j = 0; i + j <= n; j++) {
                    // 5,000

                    int k = n - i - j;
                    if (y == calc(i, j, k)) {
                        out.println(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            }
            out.println(String.format("%d %d %d", -1, -1, -1));
        }

        private int calc(int x, int y, int z) {
            return 10000 * x + 5000 * y + 1000 * z;
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Otoshidama solver = new Otoshidama();
        solver.solve(1, in, out);
        out.close();
    }

    static class Otoshidama {
        int n;
        long y;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            n = in.nextInt();
            y = in.nextLong();
            for (int i = 0; i <= n; i++) {
                // 10,000
                for (int j = 0; i + j <= n; j++) {
                    // 5,000

                    int k = n - i - j;
                    if (y == calc(i, j, k)) {
                        out.println(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            }
            out.println(String.format("%d %d %d", -1, -1, -1));
        }

        private int calc(int x, int y, int z) {
            return 10000 * x + 5000 * y + 1000 * z;
        }

    }
}

