import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args){
        int n = 0;
        long m = 0L;
        try{
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String str = reader.readLine();
            String[] s = str.split(" ");
            n = Integer.parseInt(s[0]);
            m = Long.parseLong(s[1]);
        } catch (IOException e){
            e.printStackTrace();
        }
        calc(n,m);
    }

    public static int calc(int n,long m){
        int x,y;
        boolean flg=true;
        m = m / 1000;
        if(m > 20000){
            System.out.println("-1 -1 -1");
            return 0;
        } else{
            int z1 = (int)m % 5;
            n -= z1;
            m = m - z1;
            for (x = 0;x <= n;x++){
                for(y = 0;y <= n-x;y++){
                    if((10 * x + 5 * y + (n - x - y)) == m){
                        System.out.println(x + " " + y + " " + (n-x-y+z1));
                        flg = false;
                        return 0;
                    }
                }
            }
            if(flg){
            System.out.println("-1 -1 -1");
            }
            return 0;
        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args){
        int n = 0;
        long m = 0L;
        try{
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String str = reader.readLine();
            String[] s = str.split(" ");
            n = Integer.parseInt(s[0]);
            m = Long.parseLong(s[1]);
        } catch (IOException e){
            e.printStackTrace();
        }
        calc(n,m);
    }

    public static int calc(int n,long m){
        int x,y;
        boolean flg=true;
        m = m / 1000;
        if(m > 20000){
            System.out.println("-1 -1 -1");
            return 0;
        } else{
            int z1 = (int)m % 5;
            n -= z1;
            m = m - z1;
            for (x = 0;x <= n;x++){
                for(y = 0;y <= n-x;y++){
                    if((10 * x + 5 * y + (n - x - y)) == m){
                        System.out.println(x + " " + y + " " + (n-x-y+z1));
                        flg = false;
                        return 0;
                    }
                }
            }
            if(flg){
            System.out.println("-1 -1 -1");
            }
            return 0;
        }
    }
} Main public static void main(String[] args){
        int n = 0;
        long m = 0L;
        try{
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String str = reader.readLine();
            String[] s = str.split(" ");
            n = Integer.parseInt(s[0]);
            m = Long.parseLong(s[1]);
        } catch (IOException e){
            e.printStackTrace();
        }
        calc(n,m);
    } main {
        int n = 0;
        long m = 0L;
        try{
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String str = reader.readLine();
            String[] s = str.split(" ");
            n = Integer.parseInt(s[0]);
            m = Long.parseLong(s[1]);
        } catch (IOException e){
            e.printStackTrace();
        }
        calc(n,m);
    } int n = 0; n 0 long m = 0L; m 0L try{
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String str = reader.readLine();
            String[] s = str.split(" ");
            n = Integer.parseInt(s[0]);
            m = Long.parseLong(s[1]);
        } catch (IOException e){
            e.printStackTrace();
        } catch (IOException e){
            e.printStackTrace();
        } IOException e {
            e.printStackTrace();
        } e.printStackTrace() e.printStackTrace e {
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String str = reader.readLine();
            String[] s = str.split(" ");
            n = Integer.parseInt(s[0]);
            m = Long.parseLong(s[1]);
        } BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) String str = reader.readLine(); str reader.readLine() reader.readLine reader String[] s = str.split(" "); s str.split(" ") str.split str " " n = Integer.parseInt(s[0]) n Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 m = Long.parseLong(s[1]) m Long.parseLong(s[1]) Long.parseLong Long s[1] s 1 calc(n,m) calc n m String[] args args public static int calc(int n,long m){
        int x,y;
        boolean flg=true;
        m = m / 1000;
        if(m > 20000){
            System.out.println("-1 -1 -1");
            return 0;
        } else{
            int z1 = (int)m % 5;
            n -= z1;
            m = m - z1;
            for (x = 0;x <= n;x++){
                for(y = 0;y <= n-x;y++){
                    if((10 * x + 5 * y + (n - x - y)) == m){
                        System.out.println(x + " " + y + " " + (n-x-y+z1));
                        flg = false;
                        return 0;
                    }
                }
            }
            if(flg){
            System.out.println("-1 -1 -1");
            }
            return 0;
        }
    } calc {
        int x,y;
        boolean flg=true;
        m = m / 1000;
        if(m > 20000){
            System.out.println("-1 -1 -1");
            return 0;
        } else{
            int z1 = (int)m % 5;
            n -= z1;
            m = m - z1;
            for (x = 0;x <= n;x++){
                for(y = 0;y <= n-x;y++){
                    if((10 * x + 5 * y + (n - x - y)) == m){
                        System.out.println(x + " " + y + " " + (n-x-y+z1));
                        flg = false;
                        return 0;
                    }
                }
            }
            if(flg){
            System.out.println("-1 -1 -1");
            }
            return 0;
        }
    } int x x y; y boolean flg=true; flg true m = m / 1000 m m / 1000 m 1000 if(m > 20000){
            System.out.println("-1 -1 -1");
            return 0;
        } else{
            int z1 = (int)m % 5;
            n -= z1;
            m = m - z1;
            for (x = 0;x <= n;x++){
                for(y = 0;y <= n-x;y++){
                    if((10 * x + 5 * y + (n - x - y)) == m){
                        System.out.println(x + " " + y + " " + (n-x-y+z1));
                        flg = false;
                        return 0;
                    }
                }
            }
            if(flg){
            System.out.println("-1 -1 -1");
            }
            return 0;
        } m > 20000 m 20000 {
            System.out.println("-1 -1 -1");
            return 0;
        } System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" return 0; 0 {
            int z1 = (int)m % 5;
            n -= z1;
            m = m - z1;
            for (x = 0;x <= n;x++){
                for(y = 0;y <= n-x;y++){
                    if((10 * x + 5 * y + (n - x - y)) == m){
                        System.out.println(x + " " + y + " " + (n-x-y+z1));
                        flg = false;
                        return 0;
                    }
                }
            }
            if(flg){
            System.out.println("-1 -1 -1");
            }
            return 0;
        } int z1 = (int)m % 5; z1 (int)m % 5 (int)m 5 n -= z1 n z1 m = m - z1 m m - z1 m z1 for (x = 0;x <= n;x++){
                for(y = 0;y <= n-x;y++){
                    if((10 * x + 5 * y + (n - x - y)) == m){
                        System.out.println(x + " " + y + " " + (n-x-y+z1));
                        flg = false;
                        return 0;
                    }
                }
            } x = 0; x = 0 x 0 x <= n x n x++ x++ x {
                for(y = 0;y <= n-x;y++){
                    if((10 * x + 5 * y + (n - x - y)) == m){
                        System.out.println(x + " " + y + " " + (n-x-y+z1));
                        flg = false;
                        return 0;
                    }
                }
            } {
                for(y = 0;y <= n-x;y++){
                    if((10 * x + 5 * y + (n - x - y)) == m){
                        System.out.println(x + " " + y + " " + (n-x-y+z1));
                        flg = false;
                        return 0;
                    }
                }
            } for(y = 0;y <= n-x;y++){
                    if((10 * x + 5 * y + (n - x - y)) == m){
                        System.out.println(x + " " + y + " " + (n-x-y+z1));
                        flg = false;
                        return 0;
                    }
                } y = 0; y = 0 y 0 y <= n-x y n-x n x y++ y++ y {
                    if((10 * x + 5 * y + (n - x - y)) == m){
                        System.out.println(x + " " + y + " " + (n-x-y+z1));
                        flg = false;
                        return 0;
                    }
                } {
                    if((10 * x + 5 * y + (n - x - y)) == m){
                        System.out.println(x + " " + y + " " + (n-x-y+z1));
                        flg = false;
                        return 0;
                    }
                } if((10 * x + 5 * y + (n - x - y)) == m){
                        System.out.println(x + " " + y + " " + (n-x-y+z1));
                        flg = false;
                        return 0;
                    } (10 * x + 5 * y + (n - x - y)) == m (10 * x + 5 * y + (n - x - y)) 10 * x + 5 * y + (n - x - y) 10 * x 10 x 5 * y 5 y (n - x - y) n - x - y n x y m {
                        System.out.println(x + " " + y + " " + (n-x-y+z1));
                        flg = false;
                        return 0;
                    } System.out.println(x + " " + y + " " + (n-x-y+z1)) System.out.println System.out System System.out x + " " + y + " " + (n-x-y+z1) " " y x + " " + y + " " + (n-x-y+z1) x " " y " " (n-x-y+z1) n-x-y n-x-y n x y z1 flg = false flg false return 0; 0 if(flg){
            System.out.println("-1 -1 -1");
            } flg {
            System.out.println("-1 -1 -1");
            } System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" return 0; 0 int n n long m m public class Main {
    public static void main(String[] args){
        int n = 0;
        long m = 0L;
        try{
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String str = reader.readLine();
            String[] s = str.split(" ");
            n = Integer.parseInt(s[0]);
            m = Long.parseLong(s[1]);
        } catch (IOException e){
            e.printStackTrace();
        }
        calc(n,m);
    }

    public static int calc(int n,long m){
        int x,y;
        boolean flg=true;
        m = m / 1000;
        if(m > 20000){
            System.out.println("-1 -1 -1");
            return 0;
        } else{
            int z1 = (int)m % 5;
            n -= z1;
            m = m - z1;
            for (x = 0;x <= n;x++){
                for(y = 0;y <= n-x;y++){
                    if((10 * x + 5 * y + (n - x - y)) == m){
                        System.out.println(x + " " + y + " " + (n-x-y+z1));
                        flg = false;
                        return 0;
                    }
                }
            }
            if(flg){
            System.out.println("-1 -1 -1");
            }
            return 0;
        }
    }
} public class Main {
    public static void main(String[] args){
        int n = 0;
        long m = 0L;
        try{
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String str = reader.readLine();
            String[] s = str.split(" ");
            n = Integer.parseInt(s[0]);
            m = Long.parseLong(s[1]);
        } catch (IOException e){
            e.printStackTrace();
        }
        calc(n,m);
    }

    public static int calc(int n,long m){
        int x,y;
        boolean flg=true;
        m = m / 1000;
        if(m > 20000){
            System.out.println("-1 -1 -1");
            return 0;
        } else{
            int z1 = (int)m % 5;
            n -= z1;
            m = m - z1;
            for (x = 0;x <= n;x++){
                for(y = 0;y <= n-x;y++){
                    if((10 * x + 5 * y + (n - x - y)) == m){
                        System.out.println(x + " " + y + " " + (n-x-y+z1));
                        flg = false;
                        return 0;
                    }
                }
            }
            if(flg){
            System.out.println("-1 -1 -1");
            }
            return 0;
        }
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args){
        int n = 0;
        long m = 0L;
        try{
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String str = reader.readLine();
            String[] s = str.split(" ");
            n = Integer.parseInt(s[0]);
            m = Long.parseLong(s[1]);
        } catch (IOException e){
            e.printStackTrace();
        }
        calc(n,m);
    }

    public static int calc(int n,long m){
        int x,y;
        boolean flg=true;
        m = m / 1000;
        if(m > 20000){
            System.out.println("-1 -1 -1");
            return 0;
        } else{
            int z1 = (int)m % 5;
            n -= z1;
            m = m - z1;
            for (x = 0;x <= n;x++){
                for(y = 0;y <= n-x;y++){
                    if((10 * x + 5 * y + (n - x - y)) == m){
                        System.out.println(x + " " + y + " " + (n-x-y+z1));
                        flg = false;
                        return 0;
                    }
                }
            }
            if(flg){
            System.out.println("-1 -1 -1");
            }
            return 0;
        }
    }
}