import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int Y = sc.nextInt();

        System.out.println(solve(N, Y));

        sc.close();
    }

    static String solve(int N, int Y) {
        for (int x = 0; x <= N; ++x) {
            for (int y = 0; x + y <= N; ++y) {
                int z = N - x - y;

                if (x * 10000 + y * 5000 + z * 1000 == Y) {
                    return String.format("%d %d %d", x, y, z);
                }
            }
        }

        return "-1 -1 -1";
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int Y = sc.nextInt();

        System.out.println(solve(N, Y));

        sc.close();
    }

    static String solve(int N, int Y) {
        for (int x = 0; x <= N; ++x) {
            for (int y = 0; x + y <= N; ++y) {
                int z = N - x - y;

                if (x * 10000 + y * 5000 + z * 1000 == Y) {
                    return String.format("%d %d %d", x, y, z);
                }
            }
        }

        return "-1 -1 -1";
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int Y = sc.nextInt();

        System.out.println(solve(N, Y));

        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int Y = sc.nextInt();

        System.out.println(solve(N, Y));

        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int Y = sc.nextInt(); Y sc.nextInt() sc.nextInt sc System.out.println(solve(N, Y)) System.out.println System.out System System.out solve(N, Y) solve N Y sc.close() sc.close sc String[] args args static String solve(int N, int Y) {
        for (int x = 0; x <= N; ++x) {
            for (int y = 0; x + y <= N; ++y) {
                int z = N - x - y;

                if (x * 10000 + y * 5000 + z * 1000 == Y) {
                    return String.format("%d %d %d", x, y, z);
                }
            }
        }

        return "-1 -1 -1";
    } solve {
        for (int x = 0; x <= N; ++x) {
            for (int y = 0; x + y <= N; ++y) {
                int z = N - x - y;

                if (x * 10000 + y * 5000 + z * 1000 == Y) {
                    return String.format("%d %d %d", x, y, z);
                }
            }
        }

        return "-1 -1 -1";
    } for (int x = 0; x <= N; ++x) {
            for (int y = 0; x + y <= N; ++y) {
                int z = N - x - y;

                if (x * 10000 + y * 5000 + z * 1000 == Y) {
                    return String.format("%d %d %d", x, y, z);
                }
            }
        } int x = 0; int x = 0; x 0 x <= N x N ++x ++x x {
            for (int y = 0; x + y <= N; ++y) {
                int z = N - x - y;

                if (x * 10000 + y * 5000 + z * 1000 == Y) {
                    return String.format("%d %d %d", x, y, z);
                }
            }
        } {
            for (int y = 0; x + y <= N; ++y) {
                int z = N - x - y;

                if (x * 10000 + y * 5000 + z * 1000 == Y) {
                    return String.format("%d %d %d", x, y, z);
                }
            }
        } for (int y = 0; x + y <= N; ++y) {
                int z = N - x - y;

                if (x * 10000 + y * 5000 + z * 1000 == Y) {
                    return String.format("%d %d %d", x, y, z);
                }
            } int y = 0; int y = 0; y 0 x + y <= N x + y x y N ++y ++y y {
                int z = N - x - y;

                if (x * 10000 + y * 5000 + z * 1000 == Y) {
                    return String.format("%d %d %d", x, y, z);
                }
            } {
                int z = N - x - y;

                if (x * 10000 + y * 5000 + z * 1000 == Y) {
                    return String.format("%d %d %d", x, y, z);
                }
            } int z = N - x - y; z N - x - y N - x - y N x y if (x * 10000 + y * 5000 + z * 1000 == Y) {
                    return String.format("%d %d %d", x, y, z);
                } x * 10000 + y * 5000 + z * 1000 == Y x * 10000 + y * 5000 + z * 1000 x * 10000 + y * 5000 + z * 1000 x * 10000 x 10000 y * 5000 y 5000 z * 1000 z 1000 Y {
                    return String.format("%d %d %d", x, y, z);
                } return String.format("%d %d %d", x, y, z); String.format("%d %d %d", x, y, z) String.format String "%d %d %d" x y z return "-1 -1 -1"; "-1 -1 -1" int N N int Y Y public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int Y = sc.nextInt();

        System.out.println(solve(N, Y));

        sc.close();
    }

    static String solve(int N, int Y) {
        for (int x = 0; x <= N; ++x) {
            for (int y = 0; x + y <= N; ++y) {
                int z = N - x - y;

                if (x * 10000 + y * 5000 + z * 1000 == Y) {
                    return String.format("%d %d %d", x, y, z);
                }
            }
        }

        return "-1 -1 -1";
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int Y = sc.nextInt();

        System.out.println(solve(N, Y));

        sc.close();
    }

    static String solve(int N, int Y) {
        for (int x = 0; x <= N; ++x) {
            for (int y = 0; x + y <= N; ++y) {
                int z = N - x - y;

                if (x * 10000 + y * 5000 + z * 1000 == Y) {
                    return String.format("%d %d %d", x, y, z);
                }
            }
        }

        return "-1 -1 -1";
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int Y = sc.nextInt();

        System.out.println(solve(N, Y));

        sc.close();
    }

    static String solve(int N, int Y) {
        for (int x = 0; x <= N; ++x) {
            for (int y = 0; x + y <= N; ++y) {
                int z = N - x - y;

                if (x * 10000 + y * 5000 + z * 1000 == Y) {
                    return String.format("%d %d %d", x, y, z);
                }
            }
        }

        return "-1 -1 -1";
    }
}