import java.util.*;

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




    }

} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int y = scanner.nextInt()/1000;
        boolean b = true;
        for (int i=0;i<=n;i++){
            for (int j=0;j<=n-i&&b;j++){
                if (9*i+4*j+n==y){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    b = false;
                }
            }
        }
        if (b){
            System.out.println("-1 -1 -1");
        }




    }

} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int y = scanner.nextInt()/1000;
        boolean b = true;
        for (int i=0;i<=n;i++){
            for (int j=0;j<=n-i&&b;j++){
                if (9*i+4*j+n==y){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    b = false;
                }
            }
        }
        if (b){
            System.out.println("-1 -1 -1");
        }




    } main {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int y = scanner.nextInt()/1000;
        boolean b = true;
        for (int i=0;i<=n;i++){
            for (int j=0;j<=n-i&&b;j++){
                if (9*i+4*j+n==y){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    b = false;
                }
            }
        }
        if (b){
            System.out.println("-1 -1 -1");
        }




    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int y = scanner.nextInt()/1000; y scanner.nextInt()/1000 scanner.nextInt() scanner.nextInt scanner 1000 boolean b = true; b true for (int i=0;i<=n;i++){
            for (int j=0;j<=n-i&&b;j++){
                if (9*i+4*j+n==y){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    b = false;
                }
            }
        } int i=0; int i=0; i 0 i<=n i n i++ i++ i {
            for (int j=0;j<=n-i&&b;j++){
                if (9*i+4*j+n==y){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    b = false;
                }
            }
        } {
            for (int j=0;j<=n-i&&b;j++){
                if (9*i+4*j+n==y){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    b = false;
                }
            }
        } for (int j=0;j<=n-i&&b;j++){
                if (9*i+4*j+n==y){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    b = false;
                }
            } int j=0; int j=0; j 0 j<=n-i&&b j<=n-i j n-i n i b j++ j++ j {
                if (9*i+4*j+n==y){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    b = false;
                }
            } {
                if (9*i+4*j+n==y){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    b = false;
                }
            } if (9*i+4*j+n==y){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    b = false;
                } 9*i+4*j+n==y 9*i+4*j+n 9*i+4*j+n 9*i 9 i 4*j 4 j n y {
                    System.out.println(i+" "+j+" "+(n-i-j));
                    b = false;
                } System.out.println(i+" "+j+" "+(n-i-j)) System.out.println System.out System System.out i+" "+j+" "+(n-i-j) " " j i+" "+j+" "+(n-i-j) i " " j " " (n-i-j) n-i-j n i j b = false b false if (b){
            System.out.println("-1 -1 -1");
        } b {
            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 scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int y = scanner.nextInt()/1000;
        boolean b = true;
        for (int i=0;i<=n;i++){
            for (int j=0;j<=n-i&&b;j++){
                if (9*i+4*j+n==y){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    b = false;
                }
            }
        }
        if (b){
            System.out.println("-1 -1 -1");
        }




    }

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




    }

} Main
import java.util.*;

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




    }

}
