import java.util.*;

public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] line = sc.nextLine().split(" ");        

        int num = Integer.parseInt(line[0]);
        int yen = Integer.parseInt(line[1]);

        for(int ichiman = 0; ichiman <= num;ichiman++){
            for(int gosen = 0;ichiman + gosen <= num;gosen++){
                int sen = num - ichiman - gosen;
                if(yen == 10000*ichiman+ gosen*5000 + 1000*sen){
                    System.out.println(ichiman + " " + gosen + " " + sen);
                    return;
                }
            }
        }

        System.out.println("-1" + " " + "-1" + " " + "-1");
        return;
    }
} import java.util.*; util.* java public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] line = sc.nextLine().split(" ");        

        int num = Integer.parseInt(line[0]);
        int yen = Integer.parseInt(line[1]);

        for(int ichiman = 0; ichiman <= num;ichiman++){
            for(int gosen = 0;ichiman + gosen <= num;gosen++){
                int sen = num - ichiman - gosen;
                if(yen == 10000*ichiman+ gosen*5000 + 1000*sen){
                    System.out.println(ichiman + " " + gosen + " " + sen);
                    return;
                }
            }
        }

        System.out.println("-1" + " " + "-1" + " " + "-1");
        return;
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] line = sc.nextLine().split(" ");        

        int num = Integer.parseInt(line[0]);
        int yen = Integer.parseInt(line[1]);

        for(int ichiman = 0; ichiman <= num;ichiman++){
            for(int gosen = 0;ichiman + gosen <= num;gosen++){
                int sen = num - ichiman - gosen;
                if(yen == 10000*ichiman+ gosen*5000 + 1000*sen){
                    System.out.println(ichiman + " " + gosen + " " + sen);
                    return;
                }
            }
        }

        System.out.println("-1" + " " + "-1" + " " + "-1");
        return;
    } main {
        Scanner sc = new Scanner(System.in);
        String[] line = sc.nextLine().split(" ");        

        int num = Integer.parseInt(line[0]);
        int yen = Integer.parseInt(line[1]);

        for(int ichiman = 0; ichiman <= num;ichiman++){
            for(int gosen = 0;ichiman + gosen <= num;gosen++){
                int sen = num - ichiman - gosen;
                if(yen == 10000*ichiman+ gosen*5000 + 1000*sen){
                    System.out.println(ichiman + " " + gosen + " " + sen);
                    return;
                }
            }
        }

        System.out.println("-1" + " " + "-1" + " " + "-1");
        return;
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] line = sc.nextLine().split(" "); line sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int num = Integer.parseInt(line[0]); num Integer.parseInt(line[0]) Integer.parseInt Integer line[0] line 0 int yen = Integer.parseInt(line[1]); yen Integer.parseInt(line[1]) Integer.parseInt Integer line[1] line 1 for(int ichiman = 0; ichiman <= num;ichiman++){
            for(int gosen = 0;ichiman + gosen <= num;gosen++){
                int sen = num - ichiman - gosen;
                if(yen == 10000*ichiman+ gosen*5000 + 1000*sen){
                    System.out.println(ichiman + " " + gosen + " " + sen);
                    return;
                }
            }
        } int ichiman = 0; int ichiman = 0; ichiman 0 ichiman <= num ichiman num ichiman++ ichiman++ ichiman {
            for(int gosen = 0;ichiman + gosen <= num;gosen++){
                int sen = num - ichiman - gosen;
                if(yen == 10000*ichiman+ gosen*5000 + 1000*sen){
                    System.out.println(ichiman + " " + gosen + " " + sen);
                    return;
                }
            }
        } {
            for(int gosen = 0;ichiman + gosen <= num;gosen++){
                int sen = num - ichiman - gosen;
                if(yen == 10000*ichiman+ gosen*5000 + 1000*sen){
                    System.out.println(ichiman + " " + gosen + " " + sen);
                    return;
                }
            }
        } for(int gosen = 0;ichiman + gosen <= num;gosen++){
                int sen = num - ichiman - gosen;
                if(yen == 10000*ichiman+ gosen*5000 + 1000*sen){
                    System.out.println(ichiman + " " + gosen + " " + sen);
                    return;
                }
            } int gosen = 0; int gosen = 0; gosen 0 ichiman + gosen <= num ichiman + gosen ichiman gosen num gosen++ gosen++ gosen {
                int sen = num - ichiman - gosen;
                if(yen == 10000*ichiman+ gosen*5000 + 1000*sen){
                    System.out.println(ichiman + " " + gosen + " " + sen);
                    return;
                }
            } {
                int sen = num - ichiman - gosen;
                if(yen == 10000*ichiman+ gosen*5000 + 1000*sen){
                    System.out.println(ichiman + " " + gosen + " " + sen);
                    return;
                }
            } int sen = num - ichiman - gosen; sen num - ichiman - gosen num - ichiman - gosen num ichiman gosen if(yen == 10000*ichiman+ gosen*5000 + 1000*sen){
                    System.out.println(ichiman + " " + gosen + " " + sen);
                    return;
                } yen == 10000*ichiman+ gosen*5000 + 1000*sen yen 10000*ichiman+ gosen*5000 + 1000*sen 10000*ichiman+ gosen*5000 + 1000*sen 10000*ichiman 10000 ichiman gosen*5000 gosen 5000 1000*sen 1000 sen {
                    System.out.println(ichiman + " " + gosen + " " + sen);
                    return;
                } System.out.println(ichiman + " " + gosen + " " + sen) System.out.println System.out System System.out ichiman + " " + gosen + " " + sen " " gosen ichiman + " " + gosen + " " + sen ichiman " " gosen " " sen return; System.out.println("-1" + " " + "-1" + " " + "-1") System.out.println System.out System System.out "-1" + " " + "-1" + " " + "-1" " " "-1" "-1" + " " + "-1" + " " + "-1" "-1" " " "-1" " " "-1" return; String[] args args public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] line = sc.nextLine().split(" ");        

        int num = Integer.parseInt(line[0]);
        int yen = Integer.parseInt(line[1]);

        for(int ichiman = 0; ichiman <= num;ichiman++){
            for(int gosen = 0;ichiman + gosen <= num;gosen++){
                int sen = num - ichiman - gosen;
                if(yen == 10000*ichiman+ gosen*5000 + 1000*sen){
                    System.out.println(ichiman + " " + gosen + " " + sen);
                    return;
                }
            }
        }

        System.out.println("-1" + " " + "-1" + " " + "-1");
        return;
    }
} public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] line = sc.nextLine().split(" ");        

        int num = Integer.parseInt(line[0]);
        int yen = Integer.parseInt(line[1]);

        for(int ichiman = 0; ichiman <= num;ichiman++){
            for(int gosen = 0;ichiman + gosen <= num;gosen++){
                int sen = num - ichiman - gosen;
                if(yen == 10000*ichiman+ gosen*5000 + 1000*sen){
                    System.out.println(ichiman + " " + gosen + " " + sen);
                    return;
                }
            }
        }

        System.out.println("-1" + " " + "-1" + " " + "-1");
        return;
    }
} Main
import java.util.*;

public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] line = sc.nextLine().split(" ");        

        int num = Integer.parseInt(line[0]);
        int yen = Integer.parseInt(line[1]);

        for(int ichiman = 0; ichiman <= num;ichiman++){
            for(int gosen = 0;ichiman + gosen <= num;gosen++){
                int sen = num - ichiman - gosen;
                if(yen == 10000*ichiman+ gosen*5000 + 1000*sen){
                    System.out.println(ichiman + " " + gosen + " " + sen);
                    return;
                }
            }
        }

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