import java.io.*;

public class Main {
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String input = br.readLine();
        int notes = Integer.parseInt(input.substring(0,input.indexOf(" ")));
        input = input.substring(input.indexOf(" ") + 1);
        int money_l = Integer.parseInt(input);
        int money = money_l/1000;
        String result = "-1 -1 -1";


        if(notes<=money && money<=notes*10){//too much notes or too much mooney
            OUTSIDE:for(int x = 0; x<=notes; x++){
                if(x*10>money){break;}
                if(money <= x*10 + (notes-x)*5){
                    for(int y = 0; y<=notes-x; y++){
                        if(x*10 + y*5 > money){break;}
                        if(x*10 + y*5 + (notes-x-y) == money){
                            result = String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(notes-x-y);
                            break OUTSIDE;
                        }
                    }
                }
            }
        }
    System.out.println(result);
    }
} import java.io.*; io.* java public class Main {
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String input = br.readLine();
        int notes = Integer.parseInt(input.substring(0,input.indexOf(" ")));
        input = input.substring(input.indexOf(" ") + 1);
        int money_l = Integer.parseInt(input);
        int money = money_l/1000;
        String result = "-1 -1 -1";


        if(notes<=money && money<=notes*10){//too much notes or too much mooney
            OUTSIDE:for(int x = 0; x<=notes; x++){
                if(x*10>money){break;}
                if(money <= x*10 + (notes-x)*5){
                    for(int y = 0; y<=notes-x; y++){
                        if(x*10 + y*5 > money){break;}
                        if(x*10 + y*5 + (notes-x-y) == money){
                            result = String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(notes-x-y);
                            break OUTSIDE;
                        }
                    }
                }
            }
        }
    System.out.println(result);
    }
} Main public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String input = br.readLine();
        int notes = Integer.parseInt(input.substring(0,input.indexOf(" ")));
        input = input.substring(input.indexOf(" ") + 1);
        int money_l = Integer.parseInt(input);
        int money = money_l/1000;
        String result = "-1 -1 -1";


        if(notes<=money && money<=notes*10){//too much notes or too much mooney
            OUTSIDE:for(int x = 0; x<=notes; x++){
                if(x*10>money){break;}
                if(money <= x*10 + (notes-x)*5){
                    for(int y = 0; y<=notes-x; y++){
                        if(x*10 + y*5 > money){break;}
                        if(x*10 + y*5 + (notes-x-y) == money){
                            result = String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(notes-x-y);
                            break OUTSIDE;
                        }
                    }
                }
            }
        }
    System.out.println(result);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String input = br.readLine();
        int notes = Integer.parseInt(input.substring(0,input.indexOf(" ")));
        input = input.substring(input.indexOf(" ") + 1);
        int money_l = Integer.parseInt(input);
        int money = money_l/1000;
        String result = "-1 -1 -1";


        if(notes<=money && money<=notes*10){//too much notes or too much mooney
            OUTSIDE:for(int x = 0; x<=notes; x++){
                if(x*10>money){break;}
                if(money <= x*10 + (notes-x)*5){
                    for(int y = 0; y<=notes-x; y++){
                        if(x*10 + y*5 > money){break;}
                        if(x*10 + y*5 + (notes-x-y) == money){
                            result = String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(notes-x-y);
                            break OUTSIDE;
                        }
                    }
                }
            }
        }
    System.out.println(result);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String input = br.readLine(); input br.readLine() br.readLine br int notes = Integer.parseInt(input.substring(0,input.indexOf(" "))); notes Integer.parseInt(input.substring(0,input.indexOf(" "))) Integer.parseInt Integer input.substring(0,input.indexOf(" ")) input.substring input 0 input.indexOf(" ") input.indexOf input " " input = input.substring(input.indexOf(" ") + 1) input input.substring(input.indexOf(" ") + 1) input.substring input input.indexOf(" ") + 1 input.indexOf(" ") input.indexOf input " " 1 int money_l = Integer.parseInt(input); money_l Integer.parseInt(input) Integer.parseInt Integer input int money = money_l/1000; money money_l/1000 money_l 1000 String result = "-1 -1 -1"; result "-1 -1 -1" if(notes<=money && money<=notes*10){//too much notes or too much mooney
            OUTSIDE:for(int x = 0; x<=notes; x++){
                if(x*10>money){break;}
                if(money <= x*10 + (notes-x)*5){
                    for(int y = 0; y<=notes-x; y++){
                        if(x*10 + y*5 > money){break;}
                        if(x*10 + y*5 + (notes-x-y) == money){
                            result = String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(notes-x-y);
                            break OUTSIDE;
                        }
                    }
                }
            }
        } notes<=money && money<=notes*10 notes<=money notes money money<=notes*10 money notes*10 notes 10 {//too much notes or too much mooney
            OUTSIDE:for(int x = 0; x<=notes; x++){
                if(x*10>money){break;}
                if(money <= x*10 + (notes-x)*5){
                    for(int y = 0; y<=notes-x; y++){
                        if(x*10 + y*5 > money){break;}
                        if(x*10 + y*5 + (notes-x-y) == money){
                            result = String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(notes-x-y);
                            break OUTSIDE;
                        }
                    }
                }
            }
        } System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String input = br.readLine();
        int notes = Integer.parseInt(input.substring(0,input.indexOf(" ")));
        input = input.substring(input.indexOf(" ") + 1);
        int money_l = Integer.parseInt(input);
        int money = money_l/1000;
        String result = "-1 -1 -1";


        if(notes<=money && money<=notes*10){//too much notes or too much mooney
            OUTSIDE:for(int x = 0; x<=notes; x++){
                if(x*10>money){break;}
                if(money <= x*10 + (notes-x)*5){
                    for(int y = 0; y<=notes-x; y++){
                        if(x*10 + y*5 > money){break;}
                        if(x*10 + y*5 + (notes-x-y) == money){
                            result = String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(notes-x-y);
                            break OUTSIDE;
                        }
                    }
                }
            }
        }
    System.out.println(result);
    }
} public class Main {
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String input = br.readLine();
        int notes = Integer.parseInt(input.substring(0,input.indexOf(" ")));
        input = input.substring(input.indexOf(" ") + 1);
        int money_l = Integer.parseInt(input);
        int money = money_l/1000;
        String result = "-1 -1 -1";


        if(notes<=money && money<=notes*10){//too much notes or too much mooney
            OUTSIDE:for(int x = 0; x<=notes; x++){
                if(x*10>money){break;}
                if(money <= x*10 + (notes-x)*5){
                    for(int y = 0; y<=notes-x; y++){
                        if(x*10 + y*5 > money){break;}
                        if(x*10 + y*5 + (notes-x-y) == money){
                            result = String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(notes-x-y);
                            break OUTSIDE;
                        }
                    }
                }
            }
        }
    System.out.println(result);
    }
} Main
import java.io.*;

public class Main {
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String input = br.readLine();
        int notes = Integer.parseInt(input.substring(0,input.indexOf(" ")));
        input = input.substring(input.indexOf(" ") + 1);
        int money_l = Integer.parseInt(input);
        int money = money_l/1000;
        String result = "-1 -1 -1";


        if(notes<=money && money<=notes*10){//too much notes or too much mooney
            OUTSIDE:for(int x = 0; x<=notes; x++){
                if(x*10>money){break;}
                if(money <= x*10 + (notes-x)*5){
                    for(int y = 0; y<=notes-x; y++){
                        if(x*10 + y*5 > money){break;}
                        if(x*10 + y*5 + (notes-x-y) == money){
                            result = String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(notes-x-y);
                            break OUTSIDE;
                        }
                    }
                }
            }
        }
    System.out.println(result);
    }
}