import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int a = -1;
        int b = -1;
        int c = -1; 

        for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
                if(Y == (10000*i+5000*j+1000*(N-i-j))){
                    a = i;
                    b = j;
                    c = N-i-j;
                }
                
            }
        }
        System.out.print(a + " ");
        System.out.print(b + " ");
        System.out.print(c);
    }
}    import java.util.*; util.* java public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int a = -1;
        int b = -1;
        int c = -1; 

        for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
                if(Y == (10000*i+5000*j+1000*(N-i-j))){
                    a = i;
                    b = j;
                    c = N-i-j;
                }
                
            }
        }
        System.out.print(a + " ");
        System.out.print(b + " ");
        System.out.print(c);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int a = -1;
        int b = -1;
        int c = -1; 

        for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
                if(Y == (10000*i+5000*j+1000*(N-i-j))){
                    a = i;
                    b = j;
                    c = N-i-j;
                }
                
            }
        }
        System.out.print(a + " ");
        System.out.print(b + " ");
        System.out.print(c);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int a = -1;
        int b = -1;
        int c = -1; 

        for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
                if(Y == (10000*i+5000*j+1000*(N-i-j))){
                    a = i;
                    b = j;
                    c = N-i-j;
                }
                
            }
        }
        System.out.print(a + " ");
        System.out.print(b + " ");
        System.out.print(c);
    } 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 a = -1; a -1 1 int b = -1; b -1 1 int c = -1; c -1 1 for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
                if(Y == (10000*i+5000*j+1000*(N-i-j))){
                    a = i;
                    b = j;
                    c = N-i-j;
                }
                
            }
        } int i=0; int i=0; i 0 i<=N i N i++ i++ i {
            for(int j=0;j<=N-i;j++){
                if(Y == (10000*i+5000*j+1000*(N-i-j))){
                    a = i;
                    b = j;
                    c = N-i-j;
                }
                
            }
        } {
            for(int j=0;j<=N-i;j++){
                if(Y == (10000*i+5000*j+1000*(N-i-j))){
                    a = i;
                    b = j;
                    c = N-i-j;
                }
                
            }
        } for(int j=0;j<=N-i;j++){
                if(Y == (10000*i+5000*j+1000*(N-i-j))){
                    a = i;
                    b = j;
                    c = N-i-j;
                }
                
            } int j=0; int j=0; j 0 j<=N-i j N-i N i j++ j++ j {
                if(Y == (10000*i+5000*j+1000*(N-i-j))){
                    a = i;
                    b = j;
                    c = N-i-j;
                }
                
            } {
                if(Y == (10000*i+5000*j+1000*(N-i-j))){
                    a = i;
                    b = j;
                    c = N-i-j;
                }
                
            } if(Y == (10000*i+5000*j+1000*(N-i-j))){
                    a = i;
                    b = j;
                    c = N-i-j;
                } Y == (10000*i+5000*j+1000*(N-i-j)) Y (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 {
                    a = i;
                    b = j;
                    c = N-i-j;
                } a = i a i b = j b j c = N-i-j c N-i-j N-i-j N i j System.out.print(a + " ") System.out.print System.out System System.out a + " " a " " System.out.print(b + " ") System.out.print System.out System System.out b + " " b " " System.out.print(c) System.out.print System.out System System.out c String[] args args public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int a = -1;
        int b = -1;
        int c = -1; 

        for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
                if(Y == (10000*i+5000*j+1000*(N-i-j))){
                    a = i;
                    b = j;
                    c = N-i-j;
                }
                
            }
        }
        System.out.print(a + " ");
        System.out.print(b + " ");
        System.out.print(c);
    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int a = -1;
        int b = -1;
        int c = -1; 

        for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
                if(Y == (10000*i+5000*j+1000*(N-i-j))){
                    a = i;
                    b = j;
                    c = N-i-j;
                }
                
            }
        }
        System.out.print(a + " ");
        System.out.print(b + " ");
        System.out.print(c);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int a = -1;
        int b = -1;
        int c = -1; 

        for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
                if(Y == (10000*i+5000*j+1000*(N-i-j))){
                    a = i;
                    b = j;
                    c = N-i-j;
                }
                
            }
        }
        System.out.print(a + " ");
        System.out.print(b + " ");
        System.out.print(c);
    }
}   