import java.io.*;
public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();    
        int N, Y;
        {int[] a = r.ii(); N = a[0]; Y = a[1];}
        for(int ten = 0; ten <= N; ten++){
            for(int five = 0; five <= N-ten; five++){
                int one = N-ten-five;
                if(ten*10+five*5+one == Y/1000){
                    System.out.printf("%d %d %d\n", ten, five, one);
                    return;
                }
            }
        }
        System.out.printf("%d %d %d\n", -1, -1, -1);
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static class Reader extends BufferedReader{
        Reader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }
    }
} import java.io.*; io.* java public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();    
        int N, Y;
        {int[] a = r.ii(); N = a[0]; Y = a[1];}
        for(int ten = 0; ten <= N; ten++){
            for(int five = 0; five <= N-ten; five++){
                int one = N-ten-five;
                if(ten*10+five*5+one == Y/1000){
                    System.out.printf("%d %d %d\n", ten, five, one);
                    return;
                }
            }
        }
        System.out.printf("%d %d %d\n", -1, -1, -1);
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static class Reader extends BufferedReader{
        Reader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }
    }
} Main public static void main(String[] args) throws IOException{
        Reader r = new Reader();    
        int N, Y;
        {int[] a = r.ii(); N = a[0]; Y = a[1];}
        for(int ten = 0; ten <= N; ten++){
            for(int five = 0; five <= N-ten; five++){
                int one = N-ten-five;
                if(ten*10+five*5+one == Y/1000){
                    System.out.printf("%d %d %d\n", ten, five, one);
                    return;
                }
            }
        }
        System.out.printf("%d %d %d\n", -1, -1, -1);
    } main {
        Reader r = new Reader();    
        int N, Y;
        {int[] a = r.ii(); N = a[0]; Y = a[1];}
        for(int ten = 0; ten <= N; ten++){
            for(int five = 0; five <= N-ten; five++){
                int one = N-ten-five;
                if(ten*10+five*5+one == Y/1000){
                    System.out.printf("%d %d %d\n", ten, five, one);
                    return;
                }
            }
        }
        System.out.printf("%d %d %d\n", -1, -1, -1);
    } Reader r = new Reader(); r new Reader() int N N Y; Y {int[] a = r.ii(); N = a[0]; Y = a[1];} int[] a = r.ii(); a r.ii() r.ii r N = a[0] N a[0] a 0 Y = a[1] Y a[1] a 1 for(int ten = 0; ten <= N; ten++){
            for(int five = 0; five <= N-ten; five++){
                int one = N-ten-five;
                if(ten*10+five*5+one == Y/1000){
                    System.out.printf("%d %d %d\n", ten, five, one);
                    return;
                }
            }
        } int ten = 0; int ten = 0; ten 0 ten <= N ten N ten++ ten++ ten {
            for(int five = 0; five <= N-ten; five++){
                int one = N-ten-five;
                if(ten*10+five*5+one == Y/1000){
                    System.out.printf("%d %d %d\n", ten, five, one);
                    return;
                }
            }
        } {
            for(int five = 0; five <= N-ten; five++){
                int one = N-ten-five;
                if(ten*10+five*5+one == Y/1000){
                    System.out.printf("%d %d %d\n", ten, five, one);
                    return;
                }
            }
        } for(int five = 0; five <= N-ten; five++){
                int one = N-ten-five;
                if(ten*10+five*5+one == Y/1000){
                    System.out.printf("%d %d %d\n", ten, five, one);
                    return;
                }
            } int five = 0; int five = 0; five 0 five <= N-ten five N-ten N ten five++ five++ five {
                int one = N-ten-five;
                if(ten*10+five*5+one == Y/1000){
                    System.out.printf("%d %d %d\n", ten, five, one);
                    return;
                }
            } {
                int one = N-ten-five;
                if(ten*10+five*5+one == Y/1000){
                    System.out.printf("%d %d %d\n", ten, five, one);
                    return;
                }
            } int one = N-ten-five; one N-ten-five N-ten-five N ten five if(ten*10+five*5+one == Y/1000){
                    System.out.printf("%d %d %d\n", ten, five, one);
                    return;
                } ten*10+five*5+one == Y/1000 ten*10+five*5+one ten*10+five*5+one ten*10 ten 10 five*5 five 5 one Y/1000 Y 1000 {
                    System.out.printf("%d %d %d\n", ten, five, one);
                    return;
                } System.out.printf("%d %d %d\n", ten, five, one) System.out.printf System.out System System.out "%d %d %d\n" ten five one return; System.out.printf("%d %d %d\n", -1, -1, -1) System.out.printf System.out System System.out "%d %d %d\n" -1 1 -1 1 -1 1 String[] args args static int Int(String s){
        return Integer.parseInt(s);
    } Int {
        return Integer.parseInt(s);
    } return Integer.parseInt(s); Integer.parseInt(s) Integer.parseInt Integer s String s s static class Reader extends BufferedReader{
        Reader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }
    } Reader Reader(){
            super(new InputStreamReader(System.in));
        } Reader {
            super(new InputStreamReader(System.in));
        } super(new InputStreamReader(System.in)) super new InputStreamReader(System.in) String s() throws IOException{
            return readLine();
        } s {
            return readLine();
        } return readLine(); readLine() readLine String[] ss() throws IOException{
            return s().split(" ");
        } ss {
            return s().split(" ");
        } return s().split(" "); s().split(" ") s().split s() s " " int i() throws IOException{
            return Int(s());
        } i {
            return Int(s());
        } return Int(s()); Int(s()) Int s() s int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        } ii {
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        } String[] ss = ss(); ss ss() ss int size = ss.length; size ss.length ss ss.length int[] ii = new int[size]; ii new int[size] size for(int j = 0; j < size; j++) ii[j] = Int(ss[j]); int j = 0; int j = 0; j 0 j < size j size j++ j++ j ii[j] = Int(ss[j]); ii[j] = Int(ss[j]) ii[j] ii j Int(ss[j]) Int ss[j] ss j return ii; ii BufferedReader public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();    
        int N, Y;
        {int[] a = r.ii(); N = a[0]; Y = a[1];}
        for(int ten = 0; ten <= N; ten++){
            for(int five = 0; five <= N-ten; five++){
                int one = N-ten-five;
                if(ten*10+five*5+one == Y/1000){
                    System.out.printf("%d %d %d\n", ten, five, one);
                    return;
                }
            }
        }
        System.out.printf("%d %d %d\n", -1, -1, -1);
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static class Reader extends BufferedReader{
        Reader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }
    }
} public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();    
        int N, Y;
        {int[] a = r.ii(); N = a[0]; Y = a[1];}
        for(int ten = 0; ten <= N; ten++){
            for(int five = 0; five <= N-ten; five++){
                int one = N-ten-five;
                if(ten*10+five*5+one == Y/1000){
                    System.out.printf("%d %d %d\n", ten, five, one);
                    return;
                }
            }
        }
        System.out.printf("%d %d %d\n", -1, -1, -1);
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static class Reader extends BufferedReader{
        Reader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }
    }
} Main
import java.io.*;
public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();    
        int N, Y;
        {int[] a = r.ii(); N = a[0]; Y = a[1];}
        for(int ten = 0; ten <= N; ten++){
            for(int five = 0; five <= N-ten; five++){
                int one = N-ten-five;
                if(ten*10+five*5+one == Y/1000){
                    System.out.printf("%d %d %d\n", ten, five, one);
                    return;
                }
            }
        }
        System.out.printf("%d %d %d\n", -1, -1, -1);
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static class Reader extends BufferedReader{
        Reader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }
    }
}