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

        sc.close();

        int sum = 0;
        // 10000yen
        int C = 0;

        for(int A = 0; A <= N; A++) { // 1000yen
            for(int B = 0; B <= N; B++) {
                C = N - A - B;
                sum = 10000 * C + 5000 * B + 1000 * A;
                if(sum == Y && A >= 0 && B >= 0 && C >= 0) {
                    System.out.println(C + " " + B + " " + A);
                    return;
                }
            }
        }
        System.out.println("-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();

        sc.close();

        int sum = 0;
        // 10000yen
        int C = 0;

        for(int A = 0; A <= N; A++) { // 1000yen
            for(int B = 0; B <= N; B++) {
                C = N - A - B;
                sum = 10000 * C + 5000 * B + 1000 * A;
                if(sum == Y && A >= 0 && B >= 0 && C >= 0) {
                    System.out.println(C + " " + B + " " + A);
                    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();

        sc.close();

        int sum = 0;
        // 10000yen
        int C = 0;

        for(int A = 0; A <= N; A++) { // 1000yen
            for(int B = 0; B <= N; B++) {
                C = N - A - B;
                sum = 10000 * C + 5000 * B + 1000 * A;
                if(sum == Y && A >= 0 && B >= 0 && C >= 0) {
                    System.out.println(C + " " + B + " " + A);
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    } main {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int Y = sc.nextInt();

        sc.close();

        int sum = 0;
        // 10000yen
        int C = 0;

        for(int A = 0; A <= N; A++) { // 1000yen
            for(int B = 0; B <= N; B++) {
                C = N - A - B;
                sum = 10000 * C + 5000 * B + 1000 * A;
                if(sum == Y && A >= 0 && B >= 0 && C >= 0) {
                    System.out.println(C + " " + B + " " + A);
                    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 sc.close() sc.close sc int sum = 0; sum 0 int C = 0; C 0 for(int A = 0; A <= N; A++) { // 1000yen
            for(int B = 0; B <= N; B++) {
                C = N - A - B;
                sum = 10000 * C + 5000 * B + 1000 * A;
                if(sum == Y && A >= 0 && B >= 0 && C >= 0) {
                    System.out.println(C + " " + B + " " + A);
                    return;
                }
            }
        } int A = 0; int A = 0; A 0 A <= N A N A++ A++ A { // 1000yen
            for(int B = 0; B <= N; B++) {
                C = N - A - B;
                sum = 10000 * C + 5000 * B + 1000 * A;
                if(sum == Y && A >= 0 && B >= 0 && C >= 0) {
                    System.out.println(C + " " + B + " " + A);
                    return;
                }
            }
        } { // 1000yen
            for(int B = 0; B <= N; B++) {
                C = N - A - B;
                sum = 10000 * C + 5000 * B + 1000 * A;
                if(sum == Y && A >= 0 && B >= 0 && C >= 0) {
                    System.out.println(C + " " + B + " " + A);
                    return;
                }
            }
        } for(int B = 0; B <= N; B++) {
                C = N - A - B;
                sum = 10000 * C + 5000 * B + 1000 * A;
                if(sum == Y && A >= 0 && B >= 0 && C >= 0) {
                    System.out.println(C + " " + B + " " + A);
                    return;
                }
            } int B = 0; int B = 0; B 0 B <= N B N B++ B++ B {
                C = N - A - B;
                sum = 10000 * C + 5000 * B + 1000 * A;
                if(sum == Y && A >= 0 && B >= 0 && C >= 0) {
                    System.out.println(C + " " + B + " " + A);
                    return;
                }
            } {
                C = N - A - B;
                sum = 10000 * C + 5000 * B + 1000 * A;
                if(sum == Y && A >= 0 && B >= 0 && C >= 0) {
                    System.out.println(C + " " + B + " " + A);
                    return;
                }
            } C = N - A - B C N - A - B N - A - B N A B sum = 10000 * C + 5000 * B + 1000 * A sum 10000 * C + 5000 * B + 1000 * A 10000 * C + 5000 * B + 1000 * A 10000 * C 10000 C 5000 * B 5000 B 1000 * A 1000 A if(sum == Y && A >= 0 && B >= 0 && C >= 0) {
                    System.out.println(C + " " + B + " " + A);
                    return;
                } sum == Y && A >= 0 && B >= 0 && C >= 0 B >= 0 sum == Y && A >= 0 && B >= 0 && C >= 0 sum == Y sum Y A >= 0 A 0 B >= 0 B 0 C >= 0 C 0 {
                    System.out.println(C + " " + B + " " + A);
                    return;
                } System.out.println(C + " " + B + " " + A) System.out.println System.out System System.out C + " " + B + " " + A " " B C + " " + B + " " + A C " " B " " A 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();

        sc.close();

        int sum = 0;
        // 10000yen
        int C = 0;

        for(int A = 0; A <= N; A++) { // 1000yen
            for(int B = 0; B <= N; B++) {
                C = N - A - B;
                sum = 10000 * C + 5000 * B + 1000 * A;
                if(sum == Y && A >= 0 && B >= 0 && C >= 0) {
                    System.out.println(C + " " + B + " " + A);
                    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();

        sc.close();

        int sum = 0;
        // 10000yen
        int C = 0;

        for(int A = 0; A <= N; A++) { // 1000yen
            for(int B = 0; B <= N; B++) {
                C = N - A - B;
                sum = 10000 * C + 5000 * B + 1000 * A;
                if(sum == Y && A >= 0 && B >= 0 && C >= 0) {
                    System.out.println(C + " " + B + " " + A);
                    return;
                }
            }
        }
        System.out.println("-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();

        sc.close();

        int sum = 0;
        // 10000yen
        int C = 0;

        for(int A = 0; A <= N; A++) { // 1000yen
            for(int B = 0; B <= N; B++) {
                C = N - A - B;
                sum = 10000 * C + 5000 * B + 1000 * A;
                if(sum == Y && A >= 0 && B >= 0 && C >= 0) {
                    System.out.println(C + " " + B + " " + A);
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
}