import java.util.*;

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

        int n = sc.nextInt();
        int x = sc.nextInt();

        if(x == 0){
            System.out.println("0 0 0");
            sc.close();
            System.exit(0);
        }

        for(int i = 0; i <= n; i++){
            for(int j = 0; j <= n - i; j++){
                if(10000*i + 5000*j + 1000*(n - i - j) == x){
                    System.out.println(i + " " + j + " " + (n - i - j));
                    sc.close();
                    System.exit(0);
                }
            }
        }

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

        int n = sc.nextInt();
        int x = sc.nextInt();

        if(x == 0){
            System.out.println("0 0 0");
            sc.close();
            System.exit(0);
        }

        for(int i = 0; i <= n; i++){
            for(int j = 0; j <= n - i; j++){
                if(10000*i + 5000*j + 1000*(n - i - j) == x){
                    System.out.println(i + " " + j + " " + (n - i - j));
                    sc.close();
                    System.exit(0);
                }
            }
        }

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

        int n = sc.nextInt();
        int x = sc.nextInt();

        if(x == 0){
            System.out.println("0 0 0");
            sc.close();
            System.exit(0);
        }

        for(int i = 0; i <= n; i++){
            for(int j = 0; j <= n - i; j++){
                if(10000*i + 5000*j + 1000*(n - i - j) == x){
                    System.out.println(i + " " + j + " " + (n - i - j));
                    sc.close();
                    System.exit(0);
                }
            }
        }

        System.out.println("-1 -1 -1");
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int x = sc.nextInt();

        if(x == 0){
            System.out.println("0 0 0");
            sc.close();
            System.exit(0);
        }

        for(int i = 0; i <= n; i++){
            for(int j = 0; j <= n - i; j++){
                if(10000*i + 5000*j + 1000*(n - i - j) == x){
                    System.out.println(i + " " + j + " " + (n - i - j));
                    sc.close();
                    System.exit(0);
                }
            }
        }

        System.out.println("-1 -1 -1");
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc if(x == 0){
            System.out.println("0 0 0");
            sc.close();
            System.exit(0);
        } x == 0 x 0 {
            System.out.println("0 0 0");
            sc.close();
            System.exit(0);
        } System.out.println("0 0 0") System.out.println System.out System System.out "0 0 0" sc.close() sc.close sc System.exit(0) System.exit System 0 for(int i = 0; i <= n; i++){
            for(int j = 0; j <= n - i; j++){
                if(10000*i + 5000*j + 1000*(n - i - j) == x){
                    System.out.println(i + " " + j + " " + (n - i - j));
                    sc.close();
                    System.exit(0);
                }
            }
        } int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
            for(int j = 0; j <= n - i; j++){
                if(10000*i + 5000*j + 1000*(n - i - j) == x){
                    System.out.println(i + " " + j + " " + (n - i - j));
                    sc.close();
                    System.exit(0);
                }
            }
        } {
            for(int j = 0; j <= n - i; j++){
                if(10000*i + 5000*j + 1000*(n - i - j) == x){
                    System.out.println(i + " " + j + " " + (n - i - j));
                    sc.close();
                    System.exit(0);
                }
            }
        } for(int j = 0; j <= n - i; j++){
                if(10000*i + 5000*j + 1000*(n - i - j) == x){
                    System.out.println(i + " " + j + " " + (n - i - j));
                    sc.close();
                    System.exit(0);
                }
            } int j = 0; int j = 0; j 0 j <= n - i j n - i n i j++ j++ j {
                if(10000*i + 5000*j + 1000*(n - i - j) == x){
                    System.out.println(i + " " + j + " " + (n - i - j));
                    sc.close();
                    System.exit(0);
                }
            } {
                if(10000*i + 5000*j + 1000*(n - i - j) == x){
                    System.out.println(i + " " + j + " " + (n - i - j));
                    sc.close();
                    System.exit(0);
                }
            } if(10000*i + 5000*j + 1000*(n - i - j) == x){
                    System.out.println(i + " " + j + " " + (n - i - j));
                    sc.close();
                    System.exit(0);
                } 10000*i + 5000*j + 1000*(n - i - j) == x 10000*i + 5000*j + 1000*(n - i - j) 10000*i + 5000*j + 1000*(n - i - j) 10000*i 10000 i 5000*j 5000 j 1000*(n - i - j) 1000 (n - i - j) n - i - j n i j x {
                    System.out.println(i + " " + j + " " + (n - i - j));
                    sc.close();
                    System.exit(0);
                } System.out.println(i + " " + j + " " + (n - i - j)) System.out.println System.out System System.out i + " " + j + " " + (n - i - j) " " j i + " " + j + " " + (n - i - j) i " " j " " (n - i - j) n - i - j n i j sc.close() sc.close sc System.exit(0) System.exit System 0 System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" sc.close() sc.close sc String[] args args
import java.util.*;

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

        int n = sc.nextInt();
        int x = sc.nextInt();

        if(x == 0){
            System.out.println("0 0 0");
            sc.close();
            System.exit(0);
        }

        for(int i = 0; i <= n; i++){
            for(int j = 0; j <= n - i; j++){
                if(10000*i + 5000*j + 1000*(n - i - j) == x){
                    System.out.println(i + " " + j + " " + (n - i - j));
                    sc.close();
                    System.exit(0);
                }
            }
        }

        System.out.println("-1 -1 -1");
        sc.close();
    }
}