import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner pct = new Scanner(System.in);
        int n = pct.nextInt();
        int y = pct.nextInt();
        pct.close();
        int demo = y;
        boolean ebishu = true;
        for(int i = 0 ; i <= demo / 10000 && ebishu ; i++){
            for(int j = 0 ; j <= demo / 5000 && ebishu ; j++){
                demo = y - i * 10000 - j * 5000;
                if(i + j + demo / 1000 == n && demo >= 0){
                    System.out.println(i + " " + j + " " + demo / 1000);
                    ebishu = false;
                }
                demo = y;
            }
            demo = y;
        }
        if(ebishu){
            System.out.println("-1 -1 -1");
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args){
        Scanner pct = new Scanner(System.in);
        int n = pct.nextInt();
        int y = pct.nextInt();
        pct.close();
        int demo = y;
        boolean ebishu = true;
        for(int i = 0 ; i <= demo / 10000 && ebishu ; i++){
            for(int j = 0 ; j <= demo / 5000 && ebishu ; j++){
                demo = y - i * 10000 - j * 5000;
                if(i + j + demo / 1000 == n && demo >= 0){
                    System.out.println(i + " " + j + " " + demo / 1000);
                    ebishu = false;
                }
                demo = y;
            }
            demo = y;
        }
        if(ebishu){
            System.out.println("-1 -1 -1");
        }
    }
} Main public static void main(String[] args){
        Scanner pct = new Scanner(System.in);
        int n = pct.nextInt();
        int y = pct.nextInt();
        pct.close();
        int demo = y;
        boolean ebishu = true;
        for(int i = 0 ; i <= demo / 10000 && ebishu ; i++){
            for(int j = 0 ; j <= demo / 5000 && ebishu ; j++){
                demo = y - i * 10000 - j * 5000;
                if(i + j + demo / 1000 == n && demo >= 0){
                    System.out.println(i + " " + j + " " + demo / 1000);
                    ebishu = false;
                }
                demo = y;
            }
            demo = y;
        }
        if(ebishu){
            System.out.println("-1 -1 -1");
        }
    } main {
        Scanner pct = new Scanner(System.in);
        int n = pct.nextInt();
        int y = pct.nextInt();
        pct.close();
        int demo = y;
        boolean ebishu = true;
        for(int i = 0 ; i <= demo / 10000 && ebishu ; i++){
            for(int j = 0 ; j <= demo / 5000 && ebishu ; j++){
                demo = y - i * 10000 - j * 5000;
                if(i + j + demo / 1000 == n && demo >= 0){
                    System.out.println(i + " " + j + " " + demo / 1000);
                    ebishu = false;
                }
                demo = y;
            }
            demo = y;
        }
        if(ebishu){
            System.out.println("-1 -1 -1");
        }
    } Scanner pct = new Scanner(System.in); pct new Scanner(System.in) int n = pct.nextInt(); n pct.nextInt() pct.nextInt pct int y = pct.nextInt(); y pct.nextInt() pct.nextInt pct pct.close() pct.close pct int demo = y; demo y boolean ebishu = true; ebishu true for(int i = 0 ; i <= demo / 10000 && ebishu ; i++){
            for(int j = 0 ; j <= demo / 5000 && ebishu ; j++){
                demo = y - i * 10000 - j * 5000;
                if(i + j + demo / 1000 == n && demo >= 0){
                    System.out.println(i + " " + j + " " + demo / 1000);
                    ebishu = false;
                }
                demo = y;
            }
            demo = y;
        } int i = 0 ; int i = 0 ; i 0 i <= demo / 10000 && ebishu i <= demo / 10000 i demo / 10000 demo 10000 ebishu i++ i++ i {
            for(int j = 0 ; j <= demo / 5000 && ebishu ; j++){
                demo = y - i * 10000 - j * 5000;
                if(i + j + demo / 1000 == n && demo >= 0){
                    System.out.println(i + " " + j + " " + demo / 1000);
                    ebishu = false;
                }
                demo = y;
            }
            demo = y;
        } {
            for(int j = 0 ; j <= demo / 5000 && ebishu ; j++){
                demo = y - i * 10000 - j * 5000;
                if(i + j + demo / 1000 == n && demo >= 0){
                    System.out.println(i + " " + j + " " + demo / 1000);
                    ebishu = false;
                }
                demo = y;
            }
            demo = y;
        } for(int j = 0 ; j <= demo / 5000 && ebishu ; j++){
                demo = y - i * 10000 - j * 5000;
                if(i + j + demo / 1000 == n && demo >= 0){
                    System.out.println(i + " " + j + " " + demo / 1000);
                    ebishu = false;
                }
                demo = y;
            } int j = 0 ; int j = 0 ; j 0 j <= demo / 5000 && ebishu j <= demo / 5000 j demo / 5000 demo 5000 ebishu j++ j++ j {
                demo = y - i * 10000 - j * 5000;
                if(i + j + demo / 1000 == n && demo >= 0){
                    System.out.println(i + " " + j + " " + demo / 1000);
                    ebishu = false;
                }
                demo = y;
            } {
                demo = y - i * 10000 - j * 5000;
                if(i + j + demo / 1000 == n && demo >= 0){
                    System.out.println(i + " " + j + " " + demo / 1000);
                    ebishu = false;
                }
                demo = y;
            } demo = y - i * 10000 - j * 5000 demo y - i * 10000 - j * 5000 y - i * 10000 - j * 5000 y i * 10000 i 10000 j * 5000 j 5000 if(i + j + demo / 1000 == n && demo >= 0){
                    System.out.println(i + " " + j + " " + demo / 1000);
                    ebishu = false;
                } i + j + demo / 1000 == n && demo >= 0 i + j + demo / 1000 == n i + j + demo / 1000 i + j + demo / 1000 i j demo / 1000 demo 1000 n demo >= 0 demo 0 {
                    System.out.println(i + " " + j + " " + demo / 1000);
                    ebishu = false;
                } System.out.println(i + " " + j + " " + demo / 1000) System.out.println System.out System System.out i + " " + j + " " + demo / 1000 " " j i + " " + j + " " + demo / 1000 i " " j " " demo / 1000 demo 1000 ebishu = false ebishu false demo = y demo y demo = y demo y if(ebishu){
            System.out.println("-1 -1 -1");
        } ebishu {
            System.out.println("-1 -1 -1");
        } 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){
        Scanner pct = new Scanner(System.in);
        int n = pct.nextInt();
        int y = pct.nextInt();
        pct.close();
        int demo = y;
        boolean ebishu = true;
        for(int i = 0 ; i <= demo / 10000 && ebishu ; i++){
            for(int j = 0 ; j <= demo / 5000 && ebishu ; j++){
                demo = y - i * 10000 - j * 5000;
                if(i + j + demo / 1000 == n && demo >= 0){
                    System.out.println(i + " " + j + " " + demo / 1000);
                    ebishu = false;
                }
                demo = y;
            }
            demo = y;
        }
        if(ebishu){
            System.out.println("-1 -1 -1");
        }
    }
} public class Main {
    public static void main(String[] args){
        Scanner pct = new Scanner(System.in);
        int n = pct.nextInt();
        int y = pct.nextInt();
        pct.close();
        int demo = y;
        boolean ebishu = true;
        for(int i = 0 ; i <= demo / 10000 && ebishu ; i++){
            for(int j = 0 ; j <= demo / 5000 && ebishu ; j++){
                demo = y - i * 10000 - j * 5000;
                if(i + j + demo / 1000 == n && demo >= 0){
                    System.out.println(i + " " + j + " " + demo / 1000);
                    ebishu = false;
                }
                demo = y;
            }
            demo = y;
        }
        if(ebishu){
            System.out.println("-1 -1 -1");
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner pct = new Scanner(System.in);
        int n = pct.nextInt();
        int y = pct.nextInt();
        pct.close();
        int demo = y;
        boolean ebishu = true;
        for(int i = 0 ; i <= demo / 10000 && ebishu ; i++){
            for(int j = 0 ; j <= demo / 5000 && ebishu ; j++){
                demo = y - i * 10000 - j * 5000;
                if(i + j + demo / 1000 == n && demo >= 0){
                    System.out.println(i + " " + j + " " + demo / 1000);
                    ebishu = false;
                }
                demo = y;
            }
            demo = y;
        }
        if(ebishu){
            System.out.println("-1 -1 -1");
        }
    }
}