import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
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);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = Integer.parseInt(in.next());
            int Y = Integer.parseInt(in.next());
            for (int a = 0; a <= N; a++) {
                for (int b = 0; b <= N - a; b++) {
                    int c = N - a - b;
                    int total = a * 10000 + b * 5000 + c * 1000;
                    if (total == Y) {
                        System.out.println(a + " " + b + " " + c);
                        return;
                    }
                }
            }

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

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

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = Integer.parseInt(in.next());
            int Y = Integer.parseInt(in.next());
            for (int a = 0; a <= N; a++) {
                for (int b = 0; b <= N - a; b++) {
                    int c = N - a - b;
                    int total = a * 10000 + b * 5000 + c * 1000;
                    if (total == Y) {
                        System.out.println(a + " " + b + " " + c);
                        return;
                    }
                }
            }

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

    }
} 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);
        C solver = new C();
        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);
        C solver = new C();
        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) C solver = new C(); solver new C() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = Integer.parseInt(in.next());
            int Y = Integer.parseInt(in.next());
            for (int a = 0; a <= N; a++) {
                for (int b = 0; b <= N - a; b++) {
                    int c = N - a - b;
                    int total = a * 10000 + b * 5000 + c * 1000;
                    if (total == Y) {
                        System.out.println(a + " " + b + " " + c);
                        return;
                    }
                }
            }

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

    } C public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = Integer.parseInt(in.next());
            int Y = Integer.parseInt(in.next());
            for (int a = 0; a <= N; a++) {
                for (int b = 0; b <= N - a; b++) {
                    int c = N - a - b;
                    int total = a * 10000 + b * 5000 + c * 1000;
                    if (total == Y) {
                        System.out.println(a + " " + b + " " + c);
                        return;
                    }
                }
            }

            System.out.println("-1 -1 -1");
        } solve {
            int N = Integer.parseInt(in.next());
            int Y = Integer.parseInt(in.next());
            for (int a = 0; a <= N; a++) {
                for (int b = 0; b <= N - a; b++) {
                    int c = N - a - b;
                    int total = a * 10000 + b * 5000 + c * 1000;
                    if (total == Y) {
                        System.out.println(a + " " + b + " " + c);
                        return;
                    }
                }
            }

            System.out.println("-1 -1 -1");
        } 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 for (int a = 0; a <= N; a++) {
                for (int b = 0; b <= N - a; b++) {
                    int c = N - a - b;
                    int total = a * 10000 + b * 5000 + c * 1000;
                    if (total == Y) {
                        System.out.println(a + " " + b + " " + c);
                        return;
                    }
                }
            } int a = 0; int a = 0; a 0 a <= N a N a++ a++ a {
                for (int b = 0; b <= N - a; b++) {
                    int c = N - a - b;
                    int total = a * 10000 + b * 5000 + c * 1000;
                    if (total == Y) {
                        System.out.println(a + " " + b + " " + c);
                        return;
                    }
                }
            } {
                for (int b = 0; b <= N - a; b++) {
                    int c = N - a - b;
                    int total = a * 10000 + b * 5000 + c * 1000;
                    if (total == Y) {
                        System.out.println(a + " " + b + " " + c);
                        return;
                    }
                }
            } for (int b = 0; b <= N - a; b++) {
                    int c = N - a - b;
                    int total = a * 10000 + b * 5000 + c * 1000;
                    if (total == Y) {
                        System.out.println(a + " " + b + " " + c);
                        return;
                    }
                } int b = 0; int b = 0; b 0 b <= N - a b N - a N a b++ b++ b {
                    int c = N - a - b;
                    int total = a * 10000 + b * 5000 + c * 1000;
                    if (total == Y) {
                        System.out.println(a + " " + b + " " + c);
                        return;
                    }
                } {
                    int c = N - a - b;
                    int total = a * 10000 + b * 5000 + c * 1000;
                    if (total == Y) {
                        System.out.println(a + " " + b + " " + c);
                        return;
                    }
                } int c = N - a - b; c N - a - b N - a - b N a b int total = a * 10000 + b * 5000 + c * 1000; total a * 10000 + b * 5000 + c * 1000 a * 10000 + b * 5000 + c * 1000 a * 10000 a 10000 b * 5000 b 5000 c * 1000 c 1000 if (total == Y) {
                        System.out.println(a + " " + b + " " + c);
                        return;
                    } total == Y total Y {
                        System.out.println(a + " " + b + " " + c);
                        return;
                    } System.out.println(a + " " + b + " " + c) System.out.println System.out System System.out a + " " + b + " " + c " " b a + " " + b + " " + c a " " b " " c return; System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" 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);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = Integer.parseInt(in.next());
            int Y = Integer.parseInt(in.next());
            for (int a = 0; a <= N; a++) {
                for (int b = 0; b <= N - a; b++) {
                    int c = N - a - b;
                    int total = a * 10000 + b * 5000 + c * 1000;
                    if (total == Y) {
                        System.out.println(a + " " + b + " " + c);
                        return;
                    }
                }
            }

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

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

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = Integer.parseInt(in.next());
            int Y = Integer.parseInt(in.next());
            for (int a = 0; a <= N; a++) {
                for (int b = 0; b <= N - a; b++) {
                    int c = N - a - b;
                    int total = a * 10000 + b * 5000 + c * 1000;
                    if (total == Y) {
                        System.out.println(a + " " + b + " " + c);
                        return;
                    }
                }
            }

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

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
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);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = Integer.parseInt(in.next());
            int Y = Integer.parseInt(in.next());
            for (int a = 0; a <= N; a++) {
                for (int b = 0; b <= N - a; b++) {
                    int c = N - a - b;
                    int total = a * 10000 + b * 5000 + c * 1000;
                    if (total == Y) {
                        System.out.println(a + " " + b + " " + c);
                        return;
                    }
                }
            }

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

    }
}

