import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();


        int y = Y/1000;
        for (int i = 0 ; i <= N; i++) {
            for (int j = 0 ; (i + j) <= N; j++) {
                int k = N - (i + j);
                if (i * 10 + j * 5 + k == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return;
                }
            }
        }
        System.out.println(String.format("%d %d %d", -1, -1, -1));

        return;
    }

} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
} Main public static void main(String[] args) {
        new Solver().run();
    } main {
        new Solver().run();
    } new Solver().run() new Solver().run new Solver() String[] args args class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();


        int y = Y/1000;
        for (int i = 0 ; i <= N; i++) {
            for (int j = 0 ; (i + j) <= N; j++) {
                int k = N - (i + j);
                if (i * 10 + j * 5 + k == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return;
                }
            }
        }
        System.out.println(String.format("%d %d %d", -1, -1, -1));

        return;
    }

} Solver public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();


        int y = Y/1000;
        for (int i = 0 ; i <= N; i++) {
            for (int j = 0 ; (i + j) <= N; j++) {
                int k = N - (i + j);
                if (i * 10 + j * 5 + k == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return;
                }
            }
        }
        System.out.println(String.format("%d %d %d", -1, -1, -1));

        return;
    } run {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();


        int y = Y/1000;
        for (int i = 0 ; i <= N; i++) {
            for (int j = 0 ; (i + j) <= N; j++) {
                int k = N - (i + j);
                if (i * 10 + j * 5 + k == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return;
                }
            }
        }
        System.out.println(String.format("%d %d %d", -1, -1, -1));

        return;
    } 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 int y = Y/1000; y Y/1000 Y 1000 for (int i = 0 ; i <= N; i++) {
            for (int j = 0 ; (i + j) <= N; j++) {
                int k = N - (i + j);
                if (i * 10 + j * 5 + k == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return;
                }
            }
        } int i = 0 ; int i = 0 ; i 0 i <= N i N i++ i++ i {
            for (int j = 0 ; (i + j) <= N; j++) {
                int k = N - (i + j);
                if (i * 10 + j * 5 + k == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return;
                }
            }
        } {
            for (int j = 0 ; (i + j) <= N; j++) {
                int k = N - (i + j);
                if (i * 10 + j * 5 + k == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return;
                }
            }
        } for (int j = 0 ; (i + j) <= N; j++) {
                int k = N - (i + j);
                if (i * 10 + j * 5 + k == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return;
                }
            } int j = 0 ; int j = 0 ; j 0 (i + j) <= N (i + j) i j N j++ j++ j {
                int k = N - (i + j);
                if (i * 10 + j * 5 + k == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return;
                }
            } {
                int k = N - (i + j);
                if (i * 10 + j * 5 + k == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return;
                }
            } int k = N - (i + j); k N - (i + j) N (i + j) i j if (i * 10 + j * 5 + k == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return;
                } i * 10 + j * 5 + k == y i * 10 + j * 5 + k i * 10 + j * 5 + k i * 10 i 10 j * 5 j 5 k y {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return;
                } System.out.println(String.format("%d %d %d", i, j, k)) System.out.println System.out System System.out String.format("%d %d %d", i, j, k) String.format String "%d %d %d" i j k return; System.out.println(String.format("%d %d %d", -1, -1, -1)) System.out.println System.out System System.out String.format("%d %d %d", -1, -1, -1) String.format String "%d %d %d" -1 1 -1 1 -1 1 return;
import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();


        int y = Y/1000;
        for (int i = 0 ; i <= N; i++) {
            for (int j = 0 ; (i + j) <= N; j++) {
                int k = N - (i + j);
                if (i * 10 + j * 5 + k == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return;
                }
            }
        }
        System.out.println(String.format("%d %d %d", -1, -1, -1));

        return;
    }

}