import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.util.Arrays;
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
import java.util.HashSet;

public class Main {
    // 標準入力
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    // 標準入力数値配列用 int
    static int[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    // 標準入力数値配列用 integer ソート用
    static Integer[] inputvalInteger() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        Integer[] intarray = new Integer[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    public static void main(String[] args) throws Exception {
	// write your code here
        int [] intarray = inputval();
        int n = intarray[0];
        int y = intarray[1];
        for (int i=0; i<=n; i++){
            int jMax = n-i;
            for (int j=0; j<=jMax; j++){
                int otoshidama = 10000*i+5000*j+1000*(n-i-j);
                    if (otoshidama > y){
                        break;
                    }else if (otoshidama == y){
                        System.out.println(String.valueOf(i)+" "+String.valueOf(j)+" "+String.valueOf(n-i-j));
                        return;
                    }
                }


        }
        System.out.println("-1 -1 -1");
    }

}
 import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.HashSet; HashSet java.util public class Main {
    // 標準入力
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    // 標準入力数値配列用 int
    static int[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    // 標準入力数値配列用 integer ソート用
    static Integer[] inputvalInteger() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        Integer[] intarray = new Integer[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    public static void main(String[] args) throws Exception {
	// write your code here
        int [] intarray = inputval();
        int n = intarray[0];
        int y = intarray[1];
        for (int i=0; i<=n; i++){
            int jMax = n-i;
            for (int j=0; j<=jMax; j++){
                int otoshidama = 10000*i+5000*j+1000*(n-i-j);
                    if (otoshidama > y){
                        break;
                    }else if (otoshidama == y){
                        System.out.println(String.valueOf(i)+" "+String.valueOf(j)+" "+String.valueOf(n-i-j));
                        return;
                    }
                }


        }
        System.out.println("-1 -1 -1");
    }

} Main // 標準入力
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) // 標準入力数値配列用 int
    static int[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    } inputval {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    } String[] strarray = br.readLine().trim().split(" "); strarray br.readLine().trim().split(" ") br.readLine().trim().split br.readLine().trim() br.readLine().trim br.readLine() br.readLine br " " int[] intarray = new int[strarray.length]; intarray new int[strarray.length] strarray.length strarray strarray.length for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        } int i = 0; int i = 0; i 0 i < intarray.length i intarray.length intarray intarray.length i++ i++ i {
            intarray[i] = Integer.parseInt(strarray[i]);
        } {
            intarray[i] = Integer.parseInt(strarray[i]);
        } intarray[i] = Integer.parseInt(strarray[i]) intarray[i] intarray i Integer.parseInt(strarray[i]) Integer.parseInt Integer strarray[i] strarray i return intarray; intarray // 標準入力数値配列用 integer ソート用
    static Integer[] inputvalInteger() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        Integer[] intarray = new Integer[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    } inputvalInteger {
        String[] strarray = br.readLine().trim().split(" ");
        Integer[] intarray = new Integer[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    } String[] strarray = br.readLine().trim().split(" "); strarray br.readLine().trim().split(" ") br.readLine().trim().split br.readLine().trim() br.readLine().trim br.readLine() br.readLine br " " Integer[] intarray = new Integer[strarray.length]; intarray new Integer[strarray.length] strarray.length strarray strarray.length for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        } int i = 0; int i = 0; i 0 i < intarray.length i intarray.length intarray intarray.length i++ i++ i {
            intarray[i] = Integer.parseInt(strarray[i]);
        } {
            intarray[i] = Integer.parseInt(strarray[i]);
        } intarray[i] = Integer.parseInt(strarray[i]) intarray[i] intarray i Integer.parseInt(strarray[i]) Integer.parseInt Integer strarray[i] strarray i return intarray; intarray public static void main(String[] args) throws Exception {
	// write your code here
        int [] intarray = inputval();
        int n = intarray[0];
        int y = intarray[1];
        for (int i=0; i<=n; i++){
            int jMax = n-i;
            for (int j=0; j<=jMax; j++){
                int otoshidama = 10000*i+5000*j+1000*(n-i-j);
                    if (otoshidama > y){
                        break;
                    }else if (otoshidama == y){
                        System.out.println(String.valueOf(i)+" "+String.valueOf(j)+" "+String.valueOf(n-i-j));
                        return;
                    }
                }


        }
        System.out.println("-1 -1 -1");
    } main {
	// write your code here
        int [] intarray = inputval();
        int n = intarray[0];
        int y = intarray[1];
        for (int i=0; i<=n; i++){
            int jMax = n-i;
            for (int j=0; j<=jMax; j++){
                int otoshidama = 10000*i+5000*j+1000*(n-i-j);
                    if (otoshidama > y){
                        break;
                    }else if (otoshidama == y){
                        System.out.println(String.valueOf(i)+" "+String.valueOf(j)+" "+String.valueOf(n-i-j));
                        return;
                    }
                }


        }
        System.out.println("-1 -1 -1");
    } int [] intarray = inputval(); intarray inputval() inputval int n = intarray[0]; n intarray[0] intarray 0 int y = intarray[1]; y intarray[1] intarray 1 for (int i=0; i<=n; i++){
            int jMax = n-i;
            for (int j=0; j<=jMax; j++){
                int otoshidama = 10000*i+5000*j+1000*(n-i-j);
                    if (otoshidama > y){
                        break;
                    }else if (otoshidama == y){
                        System.out.println(String.valueOf(i)+" "+String.valueOf(j)+" "+String.valueOf(n-i-j));
                        return;
                    }
                }


        } int i=0; int i=0; i 0 i<=n i n i++ i++ i {
            int jMax = n-i;
            for (int j=0; j<=jMax; j++){
                int otoshidama = 10000*i+5000*j+1000*(n-i-j);
                    if (otoshidama > y){
                        break;
                    }else if (otoshidama == y){
                        System.out.println(String.valueOf(i)+" "+String.valueOf(j)+" "+String.valueOf(n-i-j));
                        return;
                    }
                }


        } {
            int jMax = n-i;
            for (int j=0; j<=jMax; j++){
                int otoshidama = 10000*i+5000*j+1000*(n-i-j);
                    if (otoshidama > y){
                        break;
                    }else if (otoshidama == y){
                        System.out.println(String.valueOf(i)+" "+String.valueOf(j)+" "+String.valueOf(n-i-j));
                        return;
                    }
                }


        } int jMax = n-i; jMax n-i n i for (int j=0; j<=jMax; j++){
                int otoshidama = 10000*i+5000*j+1000*(n-i-j);
                    if (otoshidama > y){
                        break;
                    }else if (otoshidama == y){
                        System.out.println(String.valueOf(i)+" "+String.valueOf(j)+" "+String.valueOf(n-i-j));
                        return;
                    }
                } int j=0; int j=0; j 0 j<=jMax j jMax j++ j++ j {
                int otoshidama = 10000*i+5000*j+1000*(n-i-j);
                    if (otoshidama > y){
                        break;
                    }else if (otoshidama == y){
                        System.out.println(String.valueOf(i)+" "+String.valueOf(j)+" "+String.valueOf(n-i-j));
                        return;
                    }
                } {
                int otoshidama = 10000*i+5000*j+1000*(n-i-j);
                    if (otoshidama > y){
                        break;
                    }else if (otoshidama == y){
                        System.out.println(String.valueOf(i)+" "+String.valueOf(j)+" "+String.valueOf(n-i-j));
                        return;
                    }
                } int otoshidama = 10000*i+5000*j+1000*(n-i-j); otoshidama 10000*i+5000*j+1000*(n-i-j) 10000*i+5000*j+1000*(n-i-j) 10000*i 10000 i 5000*j 5000 j 1000*(n-i-j) 1000 (n-i-j) n-i-j n i j if (otoshidama > y){
                        break;
                    }else if (otoshidama == y){
                        System.out.println(String.valueOf(i)+" "+String.valueOf(j)+" "+String.valueOf(n-i-j));
                        return;
                    } otoshidama > y otoshidama y {
                        break;
                    } break; if (otoshidama == y){
                        System.out.println(String.valueOf(i)+" "+String.valueOf(j)+" "+String.valueOf(n-i-j));
                        return;
                    } otoshidama == y otoshidama y {
                        System.out.println(String.valueOf(i)+" "+String.valueOf(j)+" "+String.valueOf(n-i-j));
                        return;
                    } System.out.println(String.valueOf(i)+" "+String.valueOf(j)+" "+String.valueOf(n-i-j)) System.out.println System.out System System.out String.valueOf(i)+" "+String.valueOf(j)+" "+String.valueOf(n-i-j) " " String.valueOf(j) String.valueOf(i)+" "+String.valueOf(j)+" "+String.valueOf(n-i-j) String.valueOf(i) String.valueOf String i " " String.valueOf(j) String.valueOf String j " " String.valueOf(n-i-j) String.valueOf String n-i-j n-i-j n i j return; System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" String[] args args public class Main {
    // 標準入力
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    // 標準入力数値配列用 int
    static int[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    // 標準入力数値配列用 integer ソート用
    static Integer[] inputvalInteger() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        Integer[] intarray = new Integer[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    public static void main(String[] args) throws Exception {
	// write your code here
        int [] intarray = inputval();
        int n = intarray[0];
        int y = intarray[1];
        for (int i=0; i<=n; i++){
            int jMax = n-i;
            for (int j=0; j<=jMax; j++){
                int otoshidama = 10000*i+5000*j+1000*(n-i-j);
                    if (otoshidama > y){
                        break;
                    }else if (otoshidama == y){
                        System.out.println(String.valueOf(i)+" "+String.valueOf(j)+" "+String.valueOf(n-i-j));
                        return;
                    }
                }


        }
        System.out.println("-1 -1 -1");
    }

} public class Main {
    // 標準入力
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    // 標準入力数値配列用 int
    static int[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    // 標準入力数値配列用 integer ソート用
    static Integer[] inputvalInteger() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        Integer[] intarray = new Integer[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    public static void main(String[] args) throws Exception {
	// write your code here
        int [] intarray = inputval();
        int n = intarray[0];
        int y = intarray[1];
        for (int i=0; i<=n; i++){
            int jMax = n-i;
            for (int j=0; j<=jMax; j++){
                int otoshidama = 10000*i+5000*j+1000*(n-i-j);
                    if (otoshidama > y){
                        break;
                    }else if (otoshidama == y){
                        System.out.println(String.valueOf(i)+" "+String.valueOf(j)+" "+String.valueOf(n-i-j));
                        return;
                    }
                }


        }
        System.out.println("-1 -1 -1");
    }

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.util.Arrays;
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
import java.util.HashSet;

public class Main {
    // 標準入力
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    // 標準入力数値配列用 int
    static int[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    // 標準入力数値配列用 integer ソート用
    static Integer[] inputvalInteger() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        Integer[] intarray = new Integer[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    public static void main(String[] args) throws Exception {
	// write your code here
        int [] intarray = inputval();
        int n = intarray[0];
        int y = intarray[1];
        for (int i=0; i<=n; i++){
            int jMax = n-i;
            for (int j=0; j<=jMax; j++){
                int otoshidama = 10000*i+5000*j+1000*(n-i-j);
                    if (otoshidama > y){
                        break;
                    }else if (otoshidama == y){
                        System.out.println(String.valueOf(i)+" "+String.valueOf(j)+" "+String.valueOf(n-i-j));
                        return;
                    }
                }


        }
        System.out.println("-1 -1 -1");
    }

}

