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());

        for (int i = 0; i <= Y / 10000; i++) {
            for (int j = 0; j <= Y / 5000; j++) {
                int k = N - i - j;
                if (k >= 0 && Y == i * 10000 + 5000 * j + 1000 * k) {
                    System.out.printf("%d %d %d", i, j, k);
                    return;
                }
            }
        }
        System.out.print("-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 = Integer.parseInt(sc.next());
        int Y = Integer.parseInt(sc.next());

        for (int i = 0; i <= Y / 10000; i++) {
            for (int j = 0; j <= Y / 5000; j++) {
                int k = N - i - j;
                if (k >= 0 && Y == i * 10000 + 5000 * j + 1000 * k) {
                    System.out.printf("%d %d %d", i, j, k);
                    return;
                }
            }
        }
        System.out.print("-1 -1 -1");
    }
} 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());

        for (int i = 0; i <= Y / 10000; i++) {
            for (int j = 0; j <= Y / 5000; j++) {
                int k = N - i - j;
                if (k >= 0 && Y == i * 10000 + 5000 * j + 1000 * k) {
                    System.out.printf("%d %d %d", i, j, k);
                    return;
                }
            }
        }
        System.out.print("-1 -1 -1");
    } main {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int Y = Integer.parseInt(sc.next());

        for (int i = 0; i <= Y / 10000; i++) {
            for (int j = 0; j <= Y / 5000; j++) {
                int k = N - i - j;
                if (k >= 0 && Y == i * 10000 + 5000 * j + 1000 * k) {
                    System.out.printf("%d %d %d", i, j, k);
                    return;
                }
            }
        }
        System.out.print("-1 -1 -1");
    } 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 for (int i = 0; i <= Y / 10000; i++) {
            for (int j = 0; j <= Y / 5000; j++) {
                int k = N - i - j;
                if (k >= 0 && Y == i * 10000 + 5000 * j + 1000 * k) {
                    System.out.printf("%d %d %d", i, j, k);
                    return;
                }
            }
        } int i = 0; int i = 0; i 0 i <= Y / 10000 i Y / 10000 Y 10000 i++ i++ i {
            for (int j = 0; j <= Y / 5000; j++) {
                int k = N - i - j;
                if (k >= 0 && Y == i * 10000 + 5000 * j + 1000 * k) {
                    System.out.printf("%d %d %d", i, j, k);
                    return;
                }
            }
        } {
            for (int j = 0; j <= Y / 5000; j++) {
                int k = N - i - j;
                if (k >= 0 && Y == i * 10000 + 5000 * j + 1000 * k) {
                    System.out.printf("%d %d %d", i, j, k);
                    return;
                }
            }
        } for (int j = 0; j <= Y / 5000; j++) {
                int k = N - i - j;
                if (k >= 0 && Y == i * 10000 + 5000 * j + 1000 * k) {
                    System.out.printf("%d %d %d", i, j, k);
                    return;
                }
            } int j = 0; int j = 0; j 0 j <= Y / 5000 j Y / 5000 Y 5000 j++ j++ j {
                int k = N - i - j;
                if (k >= 0 && Y == i * 10000 + 5000 * j + 1000 * k) {
                    System.out.printf("%d %d %d", i, j, k);
                    return;
                }
            } {
                int k = N - i - j;
                if (k >= 0 && Y == i * 10000 + 5000 * j + 1000 * k) {
                    System.out.printf("%d %d %d", i, j, k);
                    return;
                }
            } int k = N - i - j; k N - i - j N - i - j N i j if (k >= 0 && Y == i * 10000 + 5000 * j + 1000 * k) {
                    System.out.printf("%d %d %d", i, j, k);
                    return;
                } k >= 0 && Y == i * 10000 + 5000 * j + 1000 * k k >= 0 k 0 Y == i * 10000 + 5000 * j + 1000 * k Y i * 10000 + 5000 * j + 1000 * k i * 10000 + 5000 * j + 1000 * k i * 10000 i 10000 5000 * j 5000 j 1000 * k 1000 k {
                    System.out.printf("%d %d %d", i, j, k);
                    return;
                } System.out.printf("%d %d %d", i, j, k) System.out.printf System.out System System.out "%d %d %d" i j k return; System.out.print("-1 -1 -1") System.out.print System.out System System.out "-1 -1 -1" 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());

        for (int i = 0; i <= Y / 10000; i++) {
            for (int j = 0; j <= Y / 5000; j++) {
                int k = N - i - j;
                if (k >= 0 && Y == i * 10000 + 5000 * j + 1000 * k) {
                    System.out.printf("%d %d %d", i, j, k);
                    return;
                }
            }
        }
        System.out.print("-1 -1 -1");
    }
} 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());

        for (int i = 0; i <= Y / 10000; i++) {
            for (int j = 0; j <= Y / 5000; j++) {
                int k = N - i - j;
                if (k >= 0 && Y == i * 10000 + 5000 * j + 1000 * k) {
                    System.out.printf("%d %d %d", i, j, k);
                    return;
                }
            }
        }
        System.out.print("-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 = Integer.parseInt(sc.next());
        int Y = Integer.parseInt(sc.next());

        for (int i = 0; i <= Y / 10000; i++) {
            for (int j = 0; j <= Y / 5000; j++) {
                int k = N - i - j;
                if (k >= 0 && Y == i * 10000 + 5000 * j + 1000 * k) {
                    System.out.printf("%d %d %d", i, j, k);
                    return;
                }
            }
        }
        System.out.print("-1 -1 -1");
    }
}