import java.util.Scanner;

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

        //Nはお札の枚数
        int N = stdIn.nextInt();
        //合計金額
        int Y = stdIn.nextInt();

        for (int i=0; i<=N; i++) {
            for (int j=0; j<=N-i; j++) {
                int k = N - i - j;
                int totil = i * 10000 + j * 5000 + k * 1000;
                if (totil == Y) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        }

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

        //Nはお札の枚数
        int N = stdIn.nextInt();
        //合計金額
        int Y = stdIn.nextInt();

        for (int i=0; i<=N; i++) {
            for (int j=0; j<=N-i; j++) {
                int k = N - i - j;
                int totil = i * 10000 + j * 5000 + k * 1000;
                if (totil == Y) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        }

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

        //Nはお札の枚数
        int N = stdIn.nextInt();
        //合計金額
        int Y = stdIn.nextInt();

        for (int i=0; i<=N; i++) {
            for (int j=0; j<=N-i; j++) {
                int k = N - i - j;
                int totil = i * 10000 + j * 5000 + k * 1000;
                if (totil == Y) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        }

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

        //Nはお札の枚数
        int N = stdIn.nextInt();
        //合計金額
        int Y = stdIn.nextInt();

        for (int i=0; i<=N; i++) {
            for (int j=0; j<=N-i; j++) {
                int k = N - i - j;
                int totil = i * 10000 + j * 5000 + k * 1000;
                if (totil == Y) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        }

        System.out.println("-1 -1 -1");
    } Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int N = stdIn.nextInt(); N stdIn.nextInt() stdIn.nextInt stdIn int Y = stdIn.nextInt(); Y stdIn.nextInt() stdIn.nextInt stdIn for (int i=0; i<=N; i++) {
            for (int j=0; j<=N-i; j++) {
                int k = N - i - j;
                int totil = i * 10000 + j * 5000 + k * 1000;
                if (totil == Y) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        } int i=0; int i=0; i 0 i<=N i N i++ i++ i {
            for (int j=0; j<=N-i; j++) {
                int k = N - i - j;
                int totil = i * 10000 + j * 5000 + k * 1000;
                if (totil == Y) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        } {
            for (int j=0; j<=N-i; j++) {
                int k = N - i - j;
                int totil = i * 10000 + j * 5000 + k * 1000;
                if (totil == Y) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        } for (int j=0; j<=N-i; j++) {
                int k = N - i - j;
                int totil = i * 10000 + j * 5000 + k * 1000;
                if (totil == Y) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            } int j=0; int j=0; j 0 j<=N-i j N-i N i j++ j++ j {
                int k = N - i - j;
                int totil = i * 10000 + j * 5000 + k * 1000;
                if (totil == Y) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            } {
                int k = N - i - j;
                int totil = i * 10000 + j * 5000 + k * 1000;
                if (totil == Y) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            } int k = N - i - j; k N - i - j N - i - j N i j int totil = i * 10000 + j * 5000 + k * 1000; totil i * 10000 + j * 5000 + k * 1000 i * 10000 + j * 5000 + k * 1000 i * 10000 i 10000 j * 5000 j 5000 k * 1000 k 1000 if (totil == Y) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                } totil == Y totil Y {
                    System.out.println(i + " " + j + " " + k);
                    return;
                } System.out.println(i + " " + j + " " + k) System.out.println System.out System System.out i + " " + j + " " + k " " j i + " " + j + " " + k i " " j " " k return; System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" String[] args args
import java.util.Scanner;

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

        //Nはお札の枚数
        int N = stdIn.nextInt();
        //合計金額
        int Y = stdIn.nextInt();

        for (int i=0; i<=N; i++) {
            for (int j=0; j<=N-i; j++) {
                int k = N - i - j;
                int totil = i * 10000 + j * 5000 + k * 1000;
                if (totil == Y) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        }

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