import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        int count10000 = -1;
        int count5000 = -1;
        int count1000 = -1;

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n-i; j++) {
                int tmpCount10000yen = i*10000;// 10000: i枚
                int tmpCount5000yen = j*5000;// 5000: j枚数
                int tmpCount1000yen = 0;// 1000: n-i-j枚数
                if ((n-i-j) > 0) {
                    tmpCount1000yen = (n-i-j)*1000;// 1000: n-i-j枚数
                }

                int tmpAns = tmpCount10000yen + tmpCount5000yen + tmpCount1000yen;
                if (y == tmpAns) {
                    count10000 = i;
                    count5000 = j;
                    count1000 = n-i-j;
                    break;
                }
            }
        }

        System.out.println(count10000 + " " + count5000 + " " + count1000);
    }
} import java.util.*; util.* java public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        int count10000 = -1;
        int count5000 = -1;
        int count1000 = -1;

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n-i; j++) {
                int tmpCount10000yen = i*10000;// 10000: i枚
                int tmpCount5000yen = j*5000;// 5000: j枚数
                int tmpCount1000yen = 0;// 1000: n-i-j枚数
                if ((n-i-j) > 0) {
                    tmpCount1000yen = (n-i-j)*1000;// 1000: n-i-j枚数
                }

                int tmpAns = tmpCount10000yen + tmpCount5000yen + tmpCount1000yen;
                if (y == tmpAns) {
                    count10000 = i;
                    count5000 = j;
                    count1000 = n-i-j;
                    break;
                }
            }
        }

        System.out.println(count10000 + " " + count5000 + " " + count1000);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        int count10000 = -1;
        int count5000 = -1;
        int count1000 = -1;

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n-i; j++) {
                int tmpCount10000yen = i*10000;// 10000: i枚
                int tmpCount5000yen = j*5000;// 5000: j枚数
                int tmpCount1000yen = 0;// 1000: n-i-j枚数
                if ((n-i-j) > 0) {
                    tmpCount1000yen = (n-i-j)*1000;// 1000: n-i-j枚数
                }

                int tmpAns = tmpCount10000yen + tmpCount5000yen + tmpCount1000yen;
                if (y == tmpAns) {
                    count10000 = i;
                    count5000 = j;
                    count1000 = n-i-j;
                    break;
                }
            }
        }

        System.out.println(count10000 + " " + count5000 + " " + count1000);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        int count10000 = -1;
        int count5000 = -1;
        int count1000 = -1;

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n-i; j++) {
                int tmpCount10000yen = i*10000;// 10000: i枚
                int tmpCount5000yen = j*5000;// 5000: j枚数
                int tmpCount1000yen = 0;// 1000: n-i-j枚数
                if ((n-i-j) > 0) {
                    tmpCount1000yen = (n-i-j)*1000;// 1000: n-i-j枚数
                }

                int tmpAns = tmpCount10000yen + tmpCount5000yen + tmpCount1000yen;
                if (y == tmpAns) {
                    count10000 = i;
                    count5000 = j;
                    count1000 = n-i-j;
                    break;
                }
            }
        }

        System.out.println(count10000 + " " + count5000 + " " + count1000);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int y = sc.nextInt(); y sc.nextInt() sc.nextInt sc int count10000 = -1; count10000 -1 1 int count5000 = -1; count5000 -1 1 int count1000 = -1; count1000 -1 1 for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n-i; j++) {
                int tmpCount10000yen = i*10000;// 10000: i枚
                int tmpCount5000yen = j*5000;// 5000: j枚数
                int tmpCount1000yen = 0;// 1000: n-i-j枚数
                if ((n-i-j) > 0) {
                    tmpCount1000yen = (n-i-j)*1000;// 1000: n-i-j枚数
                }

                int tmpAns = tmpCount10000yen + tmpCount5000yen + tmpCount1000yen;
                if (y == tmpAns) {
                    count10000 = i;
                    count5000 = j;
                    count1000 = n-i-j;
                    break;
                }
            }
        } int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
            for (int j = 0; j <= n-i; j++) {
                int tmpCount10000yen = i*10000;// 10000: i枚
                int tmpCount5000yen = j*5000;// 5000: j枚数
                int tmpCount1000yen = 0;// 1000: n-i-j枚数
                if ((n-i-j) > 0) {
                    tmpCount1000yen = (n-i-j)*1000;// 1000: n-i-j枚数
                }

                int tmpAns = tmpCount10000yen + tmpCount5000yen + tmpCount1000yen;
                if (y == tmpAns) {
                    count10000 = i;
                    count5000 = j;
                    count1000 = n-i-j;
                    break;
                }
            }
        } {
            for (int j = 0; j <= n-i; j++) {
                int tmpCount10000yen = i*10000;// 10000: i枚
                int tmpCount5000yen = j*5000;// 5000: j枚数
                int tmpCount1000yen = 0;// 1000: n-i-j枚数
                if ((n-i-j) > 0) {
                    tmpCount1000yen = (n-i-j)*1000;// 1000: n-i-j枚数
                }

                int tmpAns = tmpCount10000yen + tmpCount5000yen + tmpCount1000yen;
                if (y == tmpAns) {
                    count10000 = i;
                    count5000 = j;
                    count1000 = n-i-j;
                    break;
                }
            }
        } for (int j = 0; j <= n-i; j++) {
                int tmpCount10000yen = i*10000;// 10000: i枚
                int tmpCount5000yen = j*5000;// 5000: j枚数
                int tmpCount1000yen = 0;// 1000: n-i-j枚数
                if ((n-i-j) > 0) {
                    tmpCount1000yen = (n-i-j)*1000;// 1000: n-i-j枚数
                }

                int tmpAns = tmpCount10000yen + tmpCount5000yen + tmpCount1000yen;
                if (y == tmpAns) {
                    count10000 = i;
                    count5000 = j;
                    count1000 = n-i-j;
                    break;
                }
            } int j = 0; int j = 0; j 0 j <= n-i j n-i n i j++ j++ j {
                int tmpCount10000yen = i*10000;// 10000: i枚
                int tmpCount5000yen = j*5000;// 5000: j枚数
                int tmpCount1000yen = 0;// 1000: n-i-j枚数
                if ((n-i-j) > 0) {
                    tmpCount1000yen = (n-i-j)*1000;// 1000: n-i-j枚数
                }

                int tmpAns = tmpCount10000yen + tmpCount5000yen + tmpCount1000yen;
                if (y == tmpAns) {
                    count10000 = i;
                    count5000 = j;
                    count1000 = n-i-j;
                    break;
                }
            } {
                int tmpCount10000yen = i*10000;// 10000: i枚
                int tmpCount5000yen = j*5000;// 5000: j枚数
                int tmpCount1000yen = 0;// 1000: n-i-j枚数
                if ((n-i-j) > 0) {
                    tmpCount1000yen = (n-i-j)*1000;// 1000: n-i-j枚数
                }

                int tmpAns = tmpCount10000yen + tmpCount5000yen + tmpCount1000yen;
                if (y == tmpAns) {
                    count10000 = i;
                    count5000 = j;
                    count1000 = n-i-j;
                    break;
                }
            } int tmpCount10000yen = i*10000; tmpCount10000yen i*10000 i 10000 int tmpCount5000yen = j*5000; tmpCount5000yen j*5000 j 5000 int tmpCount1000yen = 0; tmpCount1000yen 0 if ((n-i-j) > 0) {
                    tmpCount1000yen = (n-i-j)*1000;// 1000: n-i-j枚数
                } (n-i-j) > 0 (n-i-j) n-i-j n i j 0 {
                    tmpCount1000yen = (n-i-j)*1000;// 1000: n-i-j枚数
                } tmpCount1000yen = (n-i-j)*1000 tmpCount1000yen (n-i-j)*1000 (n-i-j) n-i-j n i j 1000 int tmpAns = tmpCount10000yen + tmpCount5000yen + tmpCount1000yen; tmpAns tmpCount10000yen + tmpCount5000yen + tmpCount1000yen tmpCount10000yen + tmpCount5000yen + tmpCount1000yen tmpCount10000yen tmpCount5000yen tmpCount1000yen if (y == tmpAns) {
                    count10000 = i;
                    count5000 = j;
                    count1000 = n-i-j;
                    break;
                } y == tmpAns y tmpAns {
                    count10000 = i;
                    count5000 = j;
                    count1000 = n-i-j;
                    break;
                } count10000 = i count10000 i count5000 = j count5000 j count1000 = n-i-j count1000 n-i-j n-i-j n i j break; System.out.println(count10000 + " " + count5000 + " " + count1000) System.out.println System.out System System.out count10000 + " " + count5000 + " " + count1000 " " count5000 count10000 + " " + count5000 + " " + count1000 count10000 " " count5000 " " count1000 String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        int count10000 = -1;
        int count5000 = -1;
        int count1000 = -1;

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n-i; j++) {
                int tmpCount10000yen = i*10000;// 10000: i枚
                int tmpCount5000yen = j*5000;// 5000: j枚数
                int tmpCount1000yen = 0;// 1000: n-i-j枚数
                if ((n-i-j) > 0) {
                    tmpCount1000yen = (n-i-j)*1000;// 1000: n-i-j枚数
                }

                int tmpAns = tmpCount10000yen + tmpCount5000yen + tmpCount1000yen;
                if (y == tmpAns) {
                    count10000 = i;
                    count5000 = j;
                    count1000 = n-i-j;
                    break;
                }
            }
        }

        System.out.println(count10000 + " " + count5000 + " " + count1000);
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        int count10000 = -1;
        int count5000 = -1;
        int count1000 = -1;

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n-i; j++) {
                int tmpCount10000yen = i*10000;// 10000: i枚
                int tmpCount5000yen = j*5000;// 5000: j枚数
                int tmpCount1000yen = 0;// 1000: n-i-j枚数
                if ((n-i-j) > 0) {
                    tmpCount1000yen = (n-i-j)*1000;// 1000: n-i-j枚数
                }

                int tmpAns = tmpCount10000yen + tmpCount5000yen + tmpCount1000yen;
                if (y == tmpAns) {
                    count10000 = i;
                    count5000 = j;
                    count1000 = n-i-j;
                    break;
                }
            }
        }

        System.out.println(count10000 + " " + count5000 + " " + count1000);
    }
} Main
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        int count10000 = -1;
        int count5000 = -1;
        int count1000 = -1;

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n-i; j++) {
                int tmpCount10000yen = i*10000;// 10000: i枚
                int tmpCount5000yen = j*5000;// 5000: j枚数
                int tmpCount1000yen = 0;// 1000: n-i-j枚数
                if ((n-i-j) > 0) {
                    tmpCount1000yen = (n-i-j)*1000;// 1000: n-i-j枚数
                }

                int tmpAns = tmpCount10000yen + tmpCount5000yen + tmpCount1000yen;
                if (y == tmpAns) {
                    count10000 = i;
                    count5000 = j;
                    count1000 = n-i-j;
                    break;
                }
            }
        }

        System.out.println(count10000 + " " + count5000 + " " + count1000);
    }
}
