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);
        ABC085C solver = new ABC085C();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC085C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 整数の入力
            int n = Integer.parseInt(in.next());
            int y = Integer.parseInt(in.next());
            int total = 0;
            int k = 0;
            int ans10000 = -1;
            int ans5000 = -1;
            int ans1000 = -1;

            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    k = n - i - j;
                    total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == y) {
                        out.println(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k));
                        return;
                    }
                }
            }

            // 出力
            out.println(String.valueOf(ans10000) + " " + String.valueOf(ans5000) + " " + String.valueOf(ans1000));

        }

    }
}
 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);
        ABC085C solver = new ABC085C();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC085C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 整数の入力
            int n = Integer.parseInt(in.next());
            int y = Integer.parseInt(in.next());
            int total = 0;
            int k = 0;
            int ans10000 = -1;
            int ans5000 = -1;
            int ans1000 = -1;

            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    k = n - i - j;
                    total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == y) {
                        out.println(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k));
                        return;
                    }
                }
            }

            // 出力
            out.println(String.valueOf(ans10000) + " " + String.valueOf(ans5000) + " " + String.valueOf(ans1000));

        }

    }
} 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);
        ABC085C solver = new ABC085C();
        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);
        ABC085C solver = new ABC085C();
        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) ABC085C solver = new ABC085C(); solver new ABC085C() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class ABC085C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 整数の入力
            int n = Integer.parseInt(in.next());
            int y = Integer.parseInt(in.next());
            int total = 0;
            int k = 0;
            int ans10000 = -1;
            int ans5000 = -1;
            int ans1000 = -1;

            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    k = n - i - j;
                    total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == y) {
                        out.println(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k));
                        return;
                    }
                }
            }

            // 出力
            out.println(String.valueOf(ans10000) + " " + String.valueOf(ans5000) + " " + String.valueOf(ans1000));

        }

    } ABC085C public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 整数の入力
            int n = Integer.parseInt(in.next());
            int y = Integer.parseInt(in.next());
            int total = 0;
            int k = 0;
            int ans10000 = -1;
            int ans5000 = -1;
            int ans1000 = -1;

            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    k = n - i - j;
                    total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == y) {
                        out.println(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k));
                        return;
                    }
                }
            }

            // 出力
            out.println(String.valueOf(ans10000) + " " + String.valueOf(ans5000) + " " + String.valueOf(ans1000));

        } solve {
            // 整数の入力
            int n = Integer.parseInt(in.next());
            int y = Integer.parseInt(in.next());
            int total = 0;
            int k = 0;
            int ans10000 = -1;
            int ans5000 = -1;
            int ans1000 = -1;

            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    k = n - i - j;
                    total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == y) {
                        out.println(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k));
                        return;
                    }
                }
            }

            // 出力
            out.println(String.valueOf(ans10000) + " " + String.valueOf(ans5000) + " " + String.valueOf(ans1000));

        } int n = Integer.parseInt(in.next()); n Integer.parseInt(in.next()) Integer.parseInt Integer in.next() in.next in int y = Integer.parseInt(in.next()); y Integer.parseInt(in.next()) Integer.parseInt Integer in.next() in.next in int total = 0; total 0 int k = 0; k 0 int ans10000 = -1; ans10000 -1 1 int ans5000 = -1; ans5000 -1 1 int ans1000 = -1; ans1000 -1 1 for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    k = n - i - j;
                    total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == y) {
                        out.println(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k));
                        return;
                    }
                }
            } int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
                for (int j = 0; j <= n - i; j++) {
                    k = n - i - j;
                    total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == y) {
                        out.println(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k));
                        return;
                    }
                }
            } {
                for (int j = 0; j <= n - i; j++) {
                    k = n - i - j;
                    total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == y) {
                        out.println(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k));
                        return;
                    }
                }
            } for (int j = 0; j <= n - i; j++) {
                    k = n - i - j;
                    total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == y) {
                        out.println(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k));
                        return;
                    }
                } int j = 0; int j = 0; j 0 j <= n - i j n - i n i j++ j++ j {
                    k = n - i - j;
                    total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == y) {
                        out.println(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k));
                        return;
                    }
                } {
                    k = n - i - j;
                    total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == y) {
                        out.println(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k));
                        return;
                    }
                } k = n - i - j k n - i - j n - i - j n i j total = 10000 * i + 5000 * j + 1000 * k total 10000 * i + 5000 * j + 1000 * k 10000 * i + 5000 * j + 1000 * k 10000 * i 10000 i 5000 * j 5000 j 1000 * k 1000 k if (total == y) {
                        out.println(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k));
                        return;
                    } total == y total y {
                        out.println(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k));
                        return;
                    } out.println(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k)) out.println out String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k) " " String.valueOf(j) String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k) String.valueOf(i) String.valueOf String i " " String.valueOf(j) String.valueOf String j " " String.valueOf(k) String.valueOf String k return; out.println(String.valueOf(ans10000) + " " + String.valueOf(ans5000) + " " + String.valueOf(ans1000)) out.println out String.valueOf(ans10000) + " " + String.valueOf(ans5000) + " " + String.valueOf(ans1000) " " String.valueOf(ans5000) String.valueOf(ans10000) + " " + String.valueOf(ans5000) + " " + String.valueOf(ans1000) String.valueOf(ans10000) String.valueOf String ans10000 " " String.valueOf(ans5000) String.valueOf String ans5000 " " String.valueOf(ans1000) String.valueOf String ans1000 int testNumber testNumber Scanner in in PrintWriter out out 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);
        ABC085C solver = new ABC085C();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC085C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 整数の入力
            int n = Integer.parseInt(in.next());
            int y = Integer.parseInt(in.next());
            int total = 0;
            int k = 0;
            int ans10000 = -1;
            int ans5000 = -1;
            int ans1000 = -1;

            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    k = n - i - j;
                    total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == y) {
                        out.println(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k));
                        return;
                    }
                }
            }

            // 出力
            out.println(String.valueOf(ans10000) + " " + String.valueOf(ans5000) + " " + String.valueOf(ans1000));

        }

    }
} 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);
        ABC085C solver = new ABC085C();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC085C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 整数の入力
            int n = Integer.parseInt(in.next());
            int y = Integer.parseInt(in.next());
            int total = 0;
            int k = 0;
            int ans10000 = -1;
            int ans5000 = -1;
            int ans1000 = -1;

            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    k = n - i - j;
                    total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == y) {
                        out.println(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k));
                        return;
                    }
                }
            }

            // 出力
            out.println(String.valueOf(ans10000) + " " + String.valueOf(ans5000) + " " + String.valueOf(ans1000));

        }

    }
} 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);
        ABC085C solver = new ABC085C();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC085C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 整数の入力
            int n = Integer.parseInt(in.next());
            int y = Integer.parseInt(in.next());
            int total = 0;
            int k = 0;
            int ans10000 = -1;
            int ans5000 = -1;
            int ans1000 = -1;

            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    k = n - i - j;
                    total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == y) {
                        out.println(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k));
                        return;
                    }
                }
            }

            // 出力
            out.println(String.valueOf(ans10000) + " " + String.valueOf(ans5000) + " " + String.valueOf(ans1000));

        }

    }
}

