import java.util.*;

class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int y = scan.nextInt();
        for(int i = 0; i <= n; i++){
            for(int j = 0; j <= n; j++){
                int z = (y - i * 10000 - j * 5000) / 1000;
                if(z == n - i - j && 0 <= z && z <= n){
                    System.out.println(i + " " + j + " " + z);
                    return;
                }
            }
        }
        System.out.println(-1 + " " + -1 + " " + -1);
        scan.close();
    }
    
    public static void main(String[] args){
        new Main().solve();
    }
} import java.util.*; util.* java class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int y = scan.nextInt();
        for(int i = 0; i <= n; i++){
            for(int j = 0; j <= n; j++){
                int z = (y - i * 10000 - j * 5000) / 1000;
                if(z == n - i - j && 0 <= z && z <= n){
                    System.out.println(i + " " + j + " " + z);
                    return;
                }
            }
        }
        System.out.println(-1 + " " + -1 + " " + -1);
        scan.close();
    }
    
    public static void main(String[] args){
        new Main().solve();
    }
} Main void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int y = scan.nextInt();
        for(int i = 0; i <= n; i++){
            for(int j = 0; j <= n; j++){
                int z = (y - i * 10000 - j * 5000) / 1000;
                if(z == n - i - j && 0 <= z && z <= n){
                    System.out.println(i + " " + j + " " + z);
                    return;
                }
            }
        }
        System.out.println(-1 + " " + -1 + " " + -1);
        scan.close();
    } solve {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int y = scan.nextInt();
        for(int i = 0; i <= n; i++){
            for(int j = 0; j <= n; j++){
                int z = (y - i * 10000 - j * 5000) / 1000;
                if(z == n - i - j && 0 <= z && z <= n){
                    System.out.println(i + " " + j + " " + z);
                    return;
                }
            }
        }
        System.out.println(-1 + " " + -1 + " " + -1);
        scan.close();
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int y = scan.nextInt(); y scan.nextInt() scan.nextInt scan for(int i = 0; i <= n; i++){
            for(int j = 0; j <= n; j++){
                int z = (y - i * 10000 - j * 5000) / 1000;
                if(z == n - i - j && 0 <= z && z <= n){
                    System.out.println(i + " " + j + " " + z);
                    return;
                }
            }
        } int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
            for(int j = 0; j <= n; j++){
                int z = (y - i * 10000 - j * 5000) / 1000;
                if(z == n - i - j && 0 <= z && z <= n){
                    System.out.println(i + " " + j + " " + z);
                    return;
                }
            }
        } {
            for(int j = 0; j <= n; j++){
                int z = (y - i * 10000 - j * 5000) / 1000;
                if(z == n - i - j && 0 <= z && z <= n){
                    System.out.println(i + " " + j + " " + z);
                    return;
                }
            }
        } for(int j = 0; j <= n; j++){
                int z = (y - i * 10000 - j * 5000) / 1000;
                if(z == n - i - j && 0 <= z && z <= n){
                    System.out.println(i + " " + j + " " + z);
                    return;
                }
            } int j = 0; int j = 0; j 0 j <= n j n j++ j++ j {
                int z = (y - i * 10000 - j * 5000) / 1000;
                if(z == n - i - j && 0 <= z && z <= n){
                    System.out.println(i + " " + j + " " + z);
                    return;
                }
            } {
                int z = (y - i * 10000 - j * 5000) / 1000;
                if(z == n - i - j && 0 <= z && z <= n){
                    System.out.println(i + " " + j + " " + z);
                    return;
                }
            } int z = (y - i * 10000 - j * 5000) / 1000; z (y - i * 10000 - j * 5000) / 1000 (y - i * 10000 - j * 5000) y - i * 10000 - j * 5000 y i * 10000 i 10000 j * 5000 j 5000 1000 if(z == n - i - j && 0 <= z && z <= n){
                    System.out.println(i + " " + j + " " + z);
                    return;
                } z == n - i - j && 0 <= z && z <= n z == n - i - j && 0 <= z && z <= n z == n - i - j z n - i - j n - i - j n i j 0 <= z 0 z z <= n z n {
                    System.out.println(i + " " + j + " " + z);
                    return;
                } System.out.println(i + " " + j + " " + z) System.out.println System.out System System.out i + " " + j + " " + z " " j i + " " + j + " " + z i " " j " " z return; System.out.println(-1 + " " + -1 + " " + -1) System.out.println System.out System System.out -1 + " " + -1 + " " + -1 " " -1 -1 + " " + -1 + " " + -1 -1 1 " " -1 1 " " -1 1 scan.close() scan.close scan public static void main(String[] args){
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args
import java.util.*;

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