import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int Y=sc.nextInt();
        int x=-1;
        int y=-1;
        int z=-1;
        Out:
        for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
                for(int k=0;k<=N-i-j;k++){
                    if(((i+j+k) == N) && ((10000*i+5000*j+1000*k) == Y)){
                        x=i;
                        y=j;
                        z=k;
                        break Out;
                    }
                }
            }
        }
        System.out.println(x+" "+y+" "+z);
    }
} import java.util.*; util.* java class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int Y=sc.nextInt();
        int x=-1;
        int y=-1;
        int z=-1;
        Out:
        for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
                for(int k=0;k<=N-i-j;k++){
                    if(((i+j+k) == N) && ((10000*i+5000*j+1000*k) == Y)){
                        x=i;
                        y=j;
                        z=k;
                        break Out;
                    }
                }
            }
        }
        System.out.println(x+" "+y+" "+z);
    }
} Main public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int Y=sc.nextInt();
        int x=-1;
        int y=-1;
        int z=-1;
        Out:
        for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
                for(int k=0;k<=N-i-j;k++){
                    if(((i+j+k) == N) && ((10000*i+5000*j+1000*k) == Y)){
                        x=i;
                        y=j;
                        z=k;
                        break Out;
                    }
                }
            }
        }
        System.out.println(x+" "+y+" "+z);
    } main {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int Y=sc.nextInt();
        int x=-1;
        int y=-1;
        int z=-1;
        Out:
        for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
                for(int k=0;k<=N-i-j;k++){
                    if(((i+j+k) == N) && ((10000*i+5000*j+1000*k) == Y)){
                        x=i;
                        y=j;
                        z=k;
                        break Out;
                    }
                }
            }
        }
        System.out.println(x+" "+y+" "+z);
    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int N=sc.nextInt(); N sc.nextInt() sc.nextInt sc int Y=sc.nextInt(); Y sc.nextInt() sc.nextInt sc int x=-1; x -1 1 int y=-1; y -1 1 int z=-1; z -1 1 System.out.println(x+" "+y+" "+z) System.out.println System.out System System.out x+" "+y+" "+z " " y x+" "+y+" "+z x " " y " " z 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 Y=sc.nextInt();
        int x=-1;
        int y=-1;
        int z=-1;
        Out:
        for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
                for(int k=0;k<=N-i-j;k++){
                    if(((i+j+k) == N) && ((10000*i+5000*j+1000*k) == Y)){
                        x=i;
                        y=j;
                        z=k;
                        break Out;
                    }
                }
            }
        }
        System.out.println(x+" "+y+" "+z);
    }
}