import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());

        int total = 0;
        int resa=-1;
        int resb=-1;
        int resc=-1;
        for(int a=0;a<=n;a++){
            for(int b=0;b+a<=n;b++){
                int c = n-(a+b);
                total = a*10000 + b*5000 + c*1000;
                if(total==y){
                    resa=a;
                    resb=b;
                    resc=c;
                }
            }
        }
        System.out.println(String.format("%d %d %d", resa, resb, resc));
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());

        int total = 0;
        int resa=-1;
        int resb=-1;
        int resc=-1;
        for(int a=0;a<=n;a++){
            for(int b=0;b+a<=n;b++){
                int c = n-(a+b);
                total = a*10000 + b*5000 + c*1000;
                if(total==y){
                    resa=a;
                    resb=b;
                    resc=c;
                }
            }
        }
        System.out.println(String.format("%d %d %d", resa, resb, resc));
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());

        int total = 0;
        int resa=-1;
        int resb=-1;
        int resc=-1;
        for(int a=0;a<=n;a++){
            for(int b=0;b+a<=n;b++){
                int c = n-(a+b);
                total = a*10000 + b*5000 + c*1000;
                if(total==y){
                    resa=a;
                    resb=b;
                    resc=c;
                }
            }
        }
        System.out.println(String.format("%d %d %d", resa, resb, resc));
    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());

        int total = 0;
        int resa=-1;
        int resb=-1;
        int resc=-1;
        for(int a=0;a<=n;a++){
            for(int b=0;b+a<=n;b++){
                int c = n-(a+b);
                total = a*10000 + b*5000 + c*1000;
                if(total==y){
                    resa=a;
                    resb=b;
                    resc=c;
                }
            }
        }
        System.out.println(String.format("%d %d %d", resa, resb, resc));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int y = Integer.parseInt(sc.next()); y Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int total = 0; total 0 int resa=-1; resa -1 1 int resb=-1; resb -1 1 int resc=-1; resc -1 1 for(int a=0;a<=n;a++){
            for(int b=0;b+a<=n;b++){
                int c = n-(a+b);
                total = a*10000 + b*5000 + c*1000;
                if(total==y){
                    resa=a;
                    resb=b;
                    resc=c;
                }
            }
        } int a=0; int a=0; a 0 a<=n a n a++ a++ a {
            for(int b=0;b+a<=n;b++){
                int c = n-(a+b);
                total = a*10000 + b*5000 + c*1000;
                if(total==y){
                    resa=a;
                    resb=b;
                    resc=c;
                }
            }
        } {
            for(int b=0;b+a<=n;b++){
                int c = n-(a+b);
                total = a*10000 + b*5000 + c*1000;
                if(total==y){
                    resa=a;
                    resb=b;
                    resc=c;
                }
            }
        } for(int b=0;b+a<=n;b++){
                int c = n-(a+b);
                total = a*10000 + b*5000 + c*1000;
                if(total==y){
                    resa=a;
                    resb=b;
                    resc=c;
                }
            } int b=0; int b=0; b 0 b+a<=n b+a b a n b++ b++ b {
                int c = n-(a+b);
                total = a*10000 + b*5000 + c*1000;
                if(total==y){
                    resa=a;
                    resb=b;
                    resc=c;
                }
            } {
                int c = n-(a+b);
                total = a*10000 + b*5000 + c*1000;
                if(total==y){
                    resa=a;
                    resb=b;
                    resc=c;
                }
            } int c = n-(a+b); c n-(a+b) n (a+b) a b total = a*10000 + b*5000 + c*1000 total a*10000 + b*5000 + c*1000 a*10000 + b*5000 + c*1000 a*10000 a 10000 b*5000 b 5000 c*1000 c 1000 if(total==y){
                    resa=a;
                    resb=b;
                    resc=c;
                } total==y total y {
                    resa=a;
                    resb=b;
                    resc=c;
                } resa=a resa a resb=b resb b resc=c resc c System.out.println(String.format("%d %d %d", resa, resb, resc)) System.out.println System.out System System.out String.format("%d %d %d", resa, resb, resc) String.format String "%d %d %d" resa resb resc String[] args args public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());

        int total = 0;
        int resa=-1;
        int resb=-1;
        int resc=-1;
        for(int a=0;a<=n;a++){
            for(int b=0;b+a<=n;b++){
                int c = n-(a+b);
                total = a*10000 + b*5000 + c*1000;
                if(total==y){
                    resa=a;
                    resb=b;
                    resc=c;
                }
            }
        }
        System.out.println(String.format("%d %d %d", resa, resb, resc));
    }
} public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());

        int total = 0;
        int resa=-1;
        int resb=-1;
        int resc=-1;
        for(int a=0;a<=n;a++){
            for(int b=0;b+a<=n;b++){
                int c = n-(a+b);
                total = a*10000 + b*5000 + c*1000;
                if(total==y){
                    resa=a;
                    resb=b;
                    resc=c;
                }
            }
        }
        System.out.println(String.format("%d %d %d", resa, resb, resc));
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());

        int total = 0;
        int resa=-1;
        int resb=-1;
        int resc=-1;
        for(int a=0;a<=n;a++){
            for(int b=0;b+a<=n;b++){
                int c = n-(a+b);
                total = a*10000 + b*5000 + c*1000;
                if(total==y){
                    resa=a;
                    resb=b;
                    resc=c;
                }
            }
        }
        System.out.println(String.format("%d %d %d", resa, resb, resc));
    }
}