import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        
        boolean fin = false;
        for(int i = 0; i <= n && !fin; i++){
            for(int j = 0; i + j <= n; j++){
                if(i*1000+j*5000+(n-i-j)*10000==y){
                    System.out.println((n-i-j) + " " + j + " " + i);
                    fin = true;
                    break;
                }
            }
        }

        if(!fin) System.out.println("-1 -1 -1");
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        
        boolean fin = false;
        for(int i = 0; i <= n && !fin; i++){
            for(int j = 0; i + j <= n; j++){
                if(i*1000+j*5000+(n-i-j)*10000==y){
                    System.out.println((n-i-j) + " " + j + " " + i);
                    fin = true;
                    break;
                }
            }
        }

        if(!fin) System.out.println("-1 -1 -1");
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        
        boolean fin = false;
        for(int i = 0; i <= n && !fin; i++){
            for(int j = 0; i + j <= n; j++){
                if(i*1000+j*5000+(n-i-j)*10000==y){
                    System.out.println((n-i-j) + " " + j + " " + i);
                    fin = true;
                    break;
                }
            }
        }

        if(!fin) System.out.println("-1 -1 -1");
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        
        boolean fin = false;
        for(int i = 0; i <= n && !fin; i++){
            for(int j = 0; i + j <= n; j++){
                if(i*1000+j*5000+(n-i-j)*10000==y){
                    System.out.println((n-i-j) + " " + j + " " + i);
                    fin = true;
                    break;
                }
            }
        }

        if(!fin) System.out.println("-1 -1 -1");
    } 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 boolean fin = false; fin false for(int i = 0; i <= n && !fin; i++){
            for(int j = 0; i + j <= n; j++){
                if(i*1000+j*5000+(n-i-j)*10000==y){
                    System.out.println((n-i-j) + " " + j + " " + i);
                    fin = true;
                    break;
                }
            }
        } int i = 0; int i = 0; i 0 i <= n && !fin i <= n i n !fin fin i++ i++ i {
            for(int j = 0; i + j <= n; j++){
                if(i*1000+j*5000+(n-i-j)*10000==y){
                    System.out.println((n-i-j) + " " + j + " " + i);
                    fin = true;
                    break;
                }
            }
        } {
            for(int j = 0; i + j <= n; j++){
                if(i*1000+j*5000+(n-i-j)*10000==y){
                    System.out.println((n-i-j) + " " + j + " " + i);
                    fin = true;
                    break;
                }
            }
        } for(int j = 0; i + j <= n; j++){
                if(i*1000+j*5000+(n-i-j)*10000==y){
                    System.out.println((n-i-j) + " " + j + " " + i);
                    fin = true;
                    break;
                }
            } int j = 0; int j = 0; j 0 i + j <= n i + j i j n j++ j++ j {
                if(i*1000+j*5000+(n-i-j)*10000==y){
                    System.out.println((n-i-j) + " " + j + " " + i);
                    fin = true;
                    break;
                }
            } {
                if(i*1000+j*5000+(n-i-j)*10000==y){
                    System.out.println((n-i-j) + " " + j + " " + i);
                    fin = true;
                    break;
                }
            } if(i*1000+j*5000+(n-i-j)*10000==y){
                    System.out.println((n-i-j) + " " + j + " " + i);
                    fin = true;
                    break;
                } i*1000+j*5000+(n-i-j)*10000==y i*1000+j*5000+(n-i-j)*10000 i*1000+j*5000+(n-i-j)*10000 i*1000 i 1000 j*5000 j 5000 (n-i-j)*10000 (n-i-j) n-i-j n i j 10000 y {
                    System.out.println((n-i-j) + " " + j + " " + i);
                    fin = true;
                    break;
                } System.out.println((n-i-j) + " " + j + " " + i) System.out.println System.out System System.out (n-i-j) + " " + j + " " + i " " j (n-i-j) + " " + j + " " + i (n-i-j) n-i-j n i j " " j " " i fin = true fin true break; if(!fin) System.out.println("-1 -1 -1"); !fin fin System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        
        boolean fin = false;
        for(int i = 0; i <= n && !fin; i++){
            for(int j = 0; i + j <= n; j++){
                if(i*1000+j*5000+(n-i-j)*10000==y){
                    System.out.println((n-i-j) + " " + j + " " + i);
                    fin = true;
                    break;
                }
            }
        }

        if(!fin) System.out.println("-1 -1 -1");
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        
        boolean fin = false;
        for(int i = 0; i <= n && !fin; i++){
            for(int j = 0; i + j <= n; j++){
                if(i*1000+j*5000+(n-i-j)*10000==y){
                    System.out.println((n-i-j) + " " + j + " " + i);
                    fin = true;
                    break;
                }
            }
        }

        if(!fin) System.out.println("-1 -1 -1");
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        
        boolean fin = false;
        for(int i = 0; i <= n && !fin; i++){
            for(int j = 0; i + j <= n; j++){
                if(i*1000+j*5000+(n-i-j)*10000==y){
                    System.out.println((n-i-j) + " " + j + " " + i);
                    fin = true;
                    break;
                }
            }
        }

        if(!fin) System.out.println("-1 -1 -1");
    }
}
