import java.util.*;

public class Main {
    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        // 枚数
        int N = sc.nextInt();
        // 合計金額
        int Y = sc.nextInt();
        // x=10000円札の枚数
        int z = 0;
        // y=5000円札の枚数
        int y = 0;

        int AnsZ = -1;
        int AnsY = -1;
        int AnsX = -1;
        for (z = 0; z <= N; z++) {
            for (y = 0; (y +z)<= N; y++) {
                int x=N-z-y;
                int tempY = 10000 * z + 5000 * y+1000*x;
                if (tempY == Y) {
                    // flag立てる
                    
                    AnsZ = z;
                    AnsY = y;
                    AnsX = x;
                    System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
                    return;
                }
            }
        }
        System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
    }
} import java.util.*; util.* java public class Main {
    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        // 枚数
        int N = sc.nextInt();
        // 合計金額
        int Y = sc.nextInt();
        // x=10000円札の枚数
        int z = 0;
        // y=5000円札の枚数
        int y = 0;

        int AnsZ = -1;
        int AnsY = -1;
        int AnsX = -1;
        for (z = 0; z <= N; z++) {
            for (y = 0; (y +z)<= N; y++) {
                int x=N-z-y;
                int tempY = 10000 * z + 5000 * y+1000*x;
                if (tempY == Y) {
                    // flag立てる
                    
                    AnsZ = z;
                    AnsY = y;
                    AnsX = x;
                    System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
                    return;
                }
            }
        }
        System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
    }
} Main public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        // 枚数
        int N = sc.nextInt();
        // 合計金額
        int Y = sc.nextInt();
        // x=10000円札の枚数
        int z = 0;
        // y=5000円札の枚数
        int y = 0;

        int AnsZ = -1;
        int AnsY = -1;
        int AnsX = -1;
        for (z = 0; z <= N; z++) {
            for (y = 0; (y +z)<= N; y++) {
                int x=N-z-y;
                int tempY = 10000 * z + 5000 * y+1000*x;
                if (tempY == Y) {
                    // flag立てる
                    
                    AnsZ = z;
                    AnsY = y;
                    AnsX = x;
                    System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
                    return;
                }
            }
        }
        System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
    } main {
        final Scanner sc = new Scanner(System.in);
        // 枚数
        int N = sc.nextInt();
        // 合計金額
        int Y = sc.nextInt();
        // x=10000円札の枚数
        int z = 0;
        // y=5000円札の枚数
        int y = 0;

        int AnsZ = -1;
        int AnsY = -1;
        int AnsX = -1;
        for (z = 0; z <= N; z++) {
            for (y = 0; (y +z)<= N; y++) {
                int x=N-z-y;
                int tempY = 10000 * z + 5000 * y+1000*x;
                if (tempY == Y) {
                    // flag立てる
                    
                    AnsZ = z;
                    AnsY = y;
                    AnsX = x;
                    System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
                    return;
                }
            }
        }
        System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
    } final 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 z = 0; z 0 int y = 0; y 0 int AnsZ = -1; AnsZ -1 1 int AnsY = -1; AnsY -1 1 int AnsX = -1; AnsX -1 1 for (z = 0; z <= N; z++) {
            for (y = 0; (y +z)<= N; y++) {
                int x=N-z-y;
                int tempY = 10000 * z + 5000 * y+1000*x;
                if (tempY == Y) {
                    // flag立てる
                    
                    AnsZ = z;
                    AnsY = y;
                    AnsX = x;
                    System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
                    return;
                }
            }
        } z = 0; z = 0 z 0 z <= N z N z++ z++ z {
            for (y = 0; (y +z)<= N; y++) {
                int x=N-z-y;
                int tempY = 10000 * z + 5000 * y+1000*x;
                if (tempY == Y) {
                    // flag立てる
                    
                    AnsZ = z;
                    AnsY = y;
                    AnsX = x;
                    System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
                    return;
                }
            }
        } {
            for (y = 0; (y +z)<= N; y++) {
                int x=N-z-y;
                int tempY = 10000 * z + 5000 * y+1000*x;
                if (tempY == Y) {
                    // flag立てる
                    
                    AnsZ = z;
                    AnsY = y;
                    AnsX = x;
                    System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
                    return;
                }
            }
        } for (y = 0; (y +z)<= N; y++) {
                int x=N-z-y;
                int tempY = 10000 * z + 5000 * y+1000*x;
                if (tempY == Y) {
                    // flag立てる
                    
                    AnsZ = z;
                    AnsY = y;
                    AnsX = x;
                    System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
                    return;
                }
            } y = 0; y = 0 y 0 (y +z)<= N (y +z) y z N y++ y++ y {
                int x=N-z-y;
                int tempY = 10000 * z + 5000 * y+1000*x;
                if (tempY == Y) {
                    // flag立てる
                    
                    AnsZ = z;
                    AnsY = y;
                    AnsX = x;
                    System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
                    return;
                }
            } {
                int x=N-z-y;
                int tempY = 10000 * z + 5000 * y+1000*x;
                if (tempY == Y) {
                    // flag立てる
                    
                    AnsZ = z;
                    AnsY = y;
                    AnsX = x;
                    System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
                    return;
                }
            } int x=N-z-y; x N-z-y N-z-y N z y int tempY = 10000 * z + 5000 * y+1000*x; tempY 10000 * z + 5000 * y+1000*x 10000 * z + 5000 * y+1000*x 10000 * z 10000 z 5000 * y 5000 y 1000*x 1000 x if (tempY == Y) {
                    // flag立てる
                    
                    AnsZ = z;
                    AnsY = y;
                    AnsX = x;
                    System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
                    return;
                } tempY == Y tempY Y {
                    // flag立てる
                    
                    AnsZ = z;
                    AnsY = y;
                    AnsX = x;
                    System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
                    return;
                } AnsZ = z AnsZ z AnsY = y AnsY y AnsX = x AnsX x System.out.println(AnsZ+" "+ AnsY+" "+ AnsX) System.out.println System.out System System.out AnsZ+" "+ AnsY+" "+ AnsX " " AnsY AnsZ+" "+ AnsY+" "+ AnsX AnsZ " " AnsY " " AnsX return; System.out.println(AnsZ+" "+ AnsY+" "+ AnsX) System.out.println System.out System System.out AnsZ+" "+ AnsY+" "+ AnsX " " AnsY AnsZ+" "+ AnsY+" "+ AnsX AnsZ " " AnsY " " AnsX final String[] args args public class Main {
    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        // 枚数
        int N = sc.nextInt();
        // 合計金額
        int Y = sc.nextInt();
        // x=10000円札の枚数
        int z = 0;
        // y=5000円札の枚数
        int y = 0;

        int AnsZ = -1;
        int AnsY = -1;
        int AnsX = -1;
        for (z = 0; z <= N; z++) {
            for (y = 0; (y +z)<= N; y++) {
                int x=N-z-y;
                int tempY = 10000 * z + 5000 * y+1000*x;
                if (tempY == Y) {
                    // flag立てる
                    
                    AnsZ = z;
                    AnsY = y;
                    AnsX = x;
                    System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
                    return;
                }
            }
        }
        System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
    }
} public class Main {
    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        // 枚数
        int N = sc.nextInt();
        // 合計金額
        int Y = sc.nextInt();
        // x=10000円札の枚数
        int z = 0;
        // y=5000円札の枚数
        int y = 0;

        int AnsZ = -1;
        int AnsY = -1;
        int AnsX = -1;
        for (z = 0; z <= N; z++) {
            for (y = 0; (y +z)<= N; y++) {
                int x=N-z-y;
                int tempY = 10000 * z + 5000 * y+1000*x;
                if (tempY == Y) {
                    // flag立てる
                    
                    AnsZ = z;
                    AnsY = y;
                    AnsX = x;
                    System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
                    return;
                }
            }
        }
        System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
    }
} Main
import java.util.*;

public class Main {
    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        // 枚数
        int N = sc.nextInt();
        // 合計金額
        int Y = sc.nextInt();
        // x=10000円札の枚数
        int z = 0;
        // y=5000円札の枚数
        int y = 0;

        int AnsZ = -1;
        int AnsY = -1;
        int AnsX = -1;
        for (z = 0; z <= N; z++) {
            for (y = 0; (y +z)<= N; y++) {
                int x=N-z-y;
                int tempY = 10000 * z + 5000 * y+1000*x;
                if (tempY == Y) {
                    // flag立てる
                    
                    AnsZ = z;
                    AnsY = y;
                    AnsX = x;
                    System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
                    return;
                }
            }
        }
        System.out.println(AnsZ+" "+ AnsY+" "+ AnsX);
    }
}