import java.util.*;

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

        for (int a = 0; a <= Math.min(N, Y/10000); a++) {
            for (int b = 0; b <= Math.min(N-a, (Y - 10000*a)/5000); b++) {
                int c = N - a - b;
                if (10000 * a + 5000 * b + 1000 * c == Y) {
                    System.out.println(a + " " + b + " " + c);
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();

        for (int a = 0; a <= Math.min(N, Y/10000); a++) {
            for (int b = 0; b <= Math.min(N-a, (Y - 10000*a)/5000); b++) {
                int c = N - a - b;
                if (10000 * a + 5000 * b + 1000 * c == Y) {
                    System.out.println(a + " " + b + " " + c);
                    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 a = 0; a <= Math.min(N, Y/10000); a++) {
            for (int b = 0; b <= Math.min(N-a, (Y - 10000*a)/5000); b++) {
                int c = N - a - b;
                if (10000 * a + 5000 * b + 1000 * c == Y) {
                    System.out.println(a + " " + b + " " + c);
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();

        for (int a = 0; a <= Math.min(N, Y/10000); a++) {
            for (int b = 0; b <= Math.min(N-a, (Y - 10000*a)/5000); b++) {
                int c = N - a - b;
                if (10000 * a + 5000 * b + 1000 * c == Y) {
                    System.out.println(a + " " + b + " " + c);
                    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 a = 0; a <= Math.min(N, Y/10000); a++) {
            for (int b = 0; b <= Math.min(N-a, (Y - 10000*a)/5000); b++) {
                int c = N - a - b;
                if (10000 * a + 5000 * b + 1000 * c == Y) {
                    System.out.println(a + " " + b + " " + c);
                    return;
                }
            }
        } int a = 0; int a = 0; a 0 a <= Math.min(N, Y/10000) a Math.min(N, Y/10000) Math.min Math N Y/10000 Y 10000 a++ a++ a {
            for (int b = 0; b <= Math.min(N-a, (Y - 10000*a)/5000); b++) {
                int c = N - a - b;
                if (10000 * a + 5000 * b + 1000 * c == Y) {
                    System.out.println(a + " " + b + " " + c);
                    return;
                }
            }
        } {
            for (int b = 0; b <= Math.min(N-a, (Y - 10000*a)/5000); b++) {
                int c = N - a - b;
                if (10000 * a + 5000 * b + 1000 * c == Y) {
                    System.out.println(a + " " + b + " " + c);
                    return;
                }
            }
        } for (int b = 0; b <= Math.min(N-a, (Y - 10000*a)/5000); b++) {
                int c = N - a - b;
                if (10000 * a + 5000 * b + 1000 * c == Y) {
                    System.out.println(a + " " + b + " " + c);
                    return;
                }
            } int b = 0; int b = 0; b 0 b <= Math.min(N-a, (Y - 10000*a)/5000) b Math.min(N-a, (Y - 10000*a)/5000) Math.min Math N-a N a (Y - 10000*a)/5000 (Y - 10000*a) Y 10000*a 10000 a 5000 b++ b++ b {
                int c = N - a - b;
                if (10000 * a + 5000 * b + 1000 * c == Y) {
                    System.out.println(a + " " + b + " " + c);
                    return;
                }
            } {
                int c = N - a - b;
                if (10000 * a + 5000 * b + 1000 * c == Y) {
                    System.out.println(a + " " + b + " " + c);
                    return;
                }
            } int c = N - a - b; c N - a - b N - a - b N a b if (10000 * a + 5000 * b + 1000 * c == Y) {
                    System.out.println(a + " " + b + " " + c);
                    return;
                } 10000 * a + 5000 * b + 1000 * c == Y 10000 * a + 5000 * b + 1000 * c 10000 * a + 5000 * b + 1000 * c 10000 * a 10000 a 5000 * b 5000 b 1000 * c 1000 c 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" String[] args args
import java.util.*;

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

        for (int a = 0; a <= Math.min(N, Y/10000); a++) {
            for (int b = 0; b <= Math.min(N-a, (Y - 10000*a)/5000); b++) {
                int c = N - a - b;
                if (10000 * a + 5000 * b + 1000 * c == Y) {
                    System.out.println(a + " " + b + " " + c);
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
}