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

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

        System.out.println("-1 -1 -1");
    }
} import java.util.*; util.* java public class Main {

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

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

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

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

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

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

        System.out.println("-1 -1 -1");
    } main {
        Scanner sc = new Scanner(System.in);

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

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

        System.out.println("-1 -1 -1");
    } 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 for (int x = 0; x <= N; x++) {
            for (int y = 0; y <= N - x; y++) {
                int z = N - x - y;
                if (x * 10000 + y * 5000 + z * 1000 == Y) {
                    System.out.printf("%d %d %d", x, y, z);
                    return;
                }
            }
        } int x = 0; int x = 0; x 0 x <= N x N x++ x++ x {
            for (int y = 0; y <= N - x; y++) {
                int z = N - x - y;
                if (x * 10000 + y * 5000 + z * 1000 == Y) {
                    System.out.printf("%d %d %d", x, y, z);
                    return;
                }
            }
        } {
            for (int y = 0; y <= N - x; y++) {
                int z = N - x - y;
                if (x * 10000 + y * 5000 + z * 1000 == Y) {
                    System.out.printf("%d %d %d", x, y, z);
                    return;
                }
            }
        } for (int y = 0; y <= N - x; y++) {
                int z = N - x - y;
                if (x * 10000 + y * 5000 + z * 1000 == Y) {
                    System.out.printf("%d %d %d", x, y, z);
                    return;
                }
            } int y = 0; int y = 0; y 0 y <= N - x y N - x N x y++ y++ y {
                int z = N - x - y;
                if (x * 10000 + y * 5000 + z * 1000 == Y) {
                    System.out.printf("%d %d %d", x, y, z);
                    return;
                }
            } {
                int z = N - x - y;
                if (x * 10000 + y * 5000 + z * 1000 == Y) {
                    System.out.printf("%d %d %d", x, y, z);
                    return;
                }
            } int z = N - x - y; z N - x - y N - x - y N x y if (x * 10000 + y * 5000 + z * 1000 == Y) {
                    System.out.printf("%d %d %d", x, y, z);
                    return;
                } 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 {
                    System.out.printf("%d %d %d", x, y, z);
                    return;
                } System.out.printf("%d %d %d", x, y, z) System.out.printf System.out System System.out "%d %d %d" x y z return; System.out.println("-1 -1 -1") System.out.println 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 = sc.nextInt();
        int Y = sc.nextInt();

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

        System.out.println("-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();

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

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

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

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

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