import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int Y = Integer.parseInt(sc.next());
        int k = 0;
        PrintWriter out = new PrintWriter(System.out);

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N - i; j++) {

                k = N - i - j;
                if (10000 * i + 5000 * j + 1000 * k == Y) {
                    out.println(i + " " + j + " " + k);
                    sc.close();
                    out.flush();
                    return;
                }
            }
        }

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

        sc.close();
        out.flush();
    }
} import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int Y = Integer.parseInt(sc.next());
        int k = 0;
        PrintWriter out = new PrintWriter(System.out);

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N - i; j++) {

                k = N - i - j;
                if (10000 * i + 5000 * j + 1000 * k == Y) {
                    out.println(i + " " + j + " " + k);
                    sc.close();
                    out.flush();
                    return;
                }
            }
        }

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

        sc.close();
        out.flush();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int Y = Integer.parseInt(sc.next());
        int k = 0;
        PrintWriter out = new PrintWriter(System.out);

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N - i; j++) {

                k = N - i - j;
                if (10000 * i + 5000 * j + 1000 * k == Y) {
                    out.println(i + " " + j + " " + k);
                    sc.close();
                    out.flush();
                    return;
                }
            }
        }

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

        sc.close();
        out.flush();
    } main {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int Y = Integer.parseInt(sc.next());
        int k = 0;
        PrintWriter out = new PrintWriter(System.out);

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N - i; j++) {

                k = N - i - j;
                if (10000 * i + 5000 * j + 1000 * k == Y) {
                    out.println(i + " " + j + " " + k);
                    sc.close();
                    out.flush();
                    return;
                }
            }
        }

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

        sc.close();
        out.flush();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int Y = Integer.parseInt(sc.next()); Y Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int k = 0; k 0 PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N - i; j++) {

                k = N - i - j;
                if (10000 * i + 5000 * j + 1000 * k == Y) {
                    out.println(i + " " + j + " " + k);
                    sc.close();
                    out.flush();
                    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;
                if (10000 * i + 5000 * j + 1000 * k == Y) {
                    out.println(i + " " + j + " " + k);
                    sc.close();
                    out.flush();
                    return;
                }
            }
        } {
            for (int j = 0; j <= N - i; j++) {

                k = N - i - j;
                if (10000 * i + 5000 * j + 1000 * k == Y) {
                    out.println(i + " " + j + " " + k);
                    sc.close();
                    out.flush();
                    return;
                }
            }
        } for (int j = 0; j <= N - i; j++) {

                k = N - i - j;
                if (10000 * i + 5000 * j + 1000 * k == Y) {
                    out.println(i + " " + j + " " + k);
                    sc.close();
                    out.flush();
                    return;
                }
            } int j = 0; int j = 0; j 0 j <= N - i j N - i N i j++ j++ j {

                k = N - i - j;
                if (10000 * i + 5000 * j + 1000 * k == Y) {
                    out.println(i + " " + j + " " + k);
                    sc.close();
                    out.flush();
                    return;
                }
            } {

                k = N - i - j;
                if (10000 * i + 5000 * j + 1000 * k == Y) {
                    out.println(i + " " + j + " " + k);
                    sc.close();
                    out.flush();
                    return;
                }
            } k = N - i - j k N - i - j N - i - j N i j if (10000 * i + 5000 * j + 1000 * k == Y) {
                    out.println(i + " " + j + " " + k);
                    sc.close();
                    out.flush();
                    return;
                } 10000 * i + 5000 * j + 1000 * k == Y 10000 * i + 5000 * j + 1000 * k 10000 * i + 5000 * j + 1000 * k 10000 * i 10000 i 5000 * j 5000 j 1000 * k 1000 k Y {
                    out.println(i + " " + j + " " + k);
                    sc.close();
                    out.flush();
                    return;
                } out.println(i + " " + j + " " + k) out.println out i + " " + j + " " + k " " j i + " " + j + " " + k i " " j " " k sc.close() sc.close sc out.flush() out.flush out return; out.println("-1 -1 -1") out.println out "-1 -1 -1" sc.close() sc.close sc out.flush() out.flush out String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int Y = Integer.parseInt(sc.next());
        int k = 0;
        PrintWriter out = new PrintWriter(System.out);

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N - i; j++) {

                k = N - i - j;
                if (10000 * i + 5000 * j + 1000 * k == Y) {
                    out.println(i + " " + j + " " + k);
                    sc.close();
                    out.flush();
                    return;
                }
            }
        }

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

        sc.close();
        out.flush();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int Y = Integer.parseInt(sc.next());
        int k = 0;
        PrintWriter out = new PrintWriter(System.out);

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N - i; j++) {

                k = N - i - j;
                if (10000 * i + 5000 * j + 1000 * k == Y) {
                    out.println(i + " " + j + " " + k);
                    sc.close();
                    out.flush();
                    return;
                }
            }
        }

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

        sc.close();
        out.flush();
    }
} Main
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int Y = Integer.parseInt(sc.next());
        int k = 0;
        PrintWriter out = new PrintWriter(System.out);

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N - i; j++) {

                k = N - i - j;
                if (10000 * i + 5000 * j + 1000 * k == Y) {
                    out.println(i + " " + j + " " + k);
                    sc.close();
                    out.flush();
                    return;
                }
            }
        }

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

        sc.close();
        out.flush();
    }
}