import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());
        sc.close();

        // 主処理
        int a = -1;
        int b = -1;
        int c = -1;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int j2 = n - (i + j);
                int total = 10000 * i + 5000 * j + 1000 * j2;
                if (total == y) {
                    a = i;
                    b = j;
                    c = j2;
                    break;
                }
            }
        }
        String result = a + " " + b + " " + c;

        // 出力
        System.out.println(result);
    }
} import java.util.*; util.* java public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());
        sc.close();

        // 主処理
        int a = -1;
        int b = -1;
        int c = -1;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int j2 = n - (i + j);
                int total = 10000 * i + 5000 * j + 1000 * j2;
                if (total == y) {
                    a = i;
                    b = j;
                    c = j2;
                    break;
                }
            }
        }
        String result = a + " " + b + " " + c;

        // 出力
        System.out.println(result);
    }
} Main public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());
        sc.close();

        // 主処理
        int a = -1;
        int b = -1;
        int c = -1;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int j2 = n - (i + j);
                int total = 10000 * i + 5000 * j + 1000 * j2;
                if (total == y) {
                    a = i;
                    b = j;
                    c = j2;
                    break;
                }
            }
        }
        String result = a + " " + b + " " + c;

        // 出力
        System.out.println(result);
    } main {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());
        sc.close();

        // 主処理
        int a = -1;
        int b = -1;
        int c = -1;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int j2 = n - (i + j);
                int total = 10000 * i + 5000 * j + 1000 * j2;
                if (total == y) {
                    a = i;
                    b = j;
                    c = j2;
                    break;
                }
            }
        }
        String result = a + " " + b + " " + c;

        // 出力
        System.out.println(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int y = Integer.parseInt(sc.next()); y Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc sc.close() sc.close sc int a = -1; a -1 1 int b = -1; b -1 1 int c = -1; c -1 1 for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int j2 = n - (i + j);
                int total = 10000 * i + 5000 * j + 1000 * j2;
                if (total == y) {
                    a = i;
                    b = j;
                    c = j2;
                    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 j2 = n - (i + j);
                int total = 10000 * i + 5000 * j + 1000 * j2;
                if (total == y) {
                    a = i;
                    b = j;
                    c = j2;
                    break;
                }
            }
        } {
            for (int j = 0; j <= n - i; j++) {
                int j2 = n - (i + j);
                int total = 10000 * i + 5000 * j + 1000 * j2;
                if (total == y) {
                    a = i;
                    b = j;
                    c = j2;
                    break;
                }
            }
        } for (int j = 0; j <= n - i; j++) {
                int j2 = n - (i + j);
                int total = 10000 * i + 5000 * j + 1000 * j2;
                if (total == y) {
                    a = i;
                    b = j;
                    c = j2;
                    break;
                }
            } int j = 0; int j = 0; j 0 j <= n - i j n - i n i j++ j++ j {
                int j2 = n - (i + j);
                int total = 10000 * i + 5000 * j + 1000 * j2;
                if (total == y) {
                    a = i;
                    b = j;
                    c = j2;
                    break;
                }
            } {
                int j2 = n - (i + j);
                int total = 10000 * i + 5000 * j + 1000 * j2;
                if (total == y) {
                    a = i;
                    b = j;
                    c = j2;
                    break;
                }
            } int j2 = n - (i + j); j2 n - (i + j) n (i + j) i j int total = 10000 * i + 5000 * j + 1000 * j2; total 10000 * i + 5000 * j + 1000 * j2 10000 * i + 5000 * j + 1000 * j2 10000 * i 10000 i 5000 * j 5000 j 1000 * j2 1000 j2 if (total == y) {
                    a = i;
                    b = j;
                    c = j2;
                    break;
                } total == y total y {
                    a = i;
                    b = j;
                    c = j2;
                    break;
                } a = i a i b = j b j c = j2 c j2 break; String result = a + " " + b + " " + c; result a + " " + b + " " + c " " b a + " " + b + " " + c a " " b " " c System.out.println(result) System.out.println System.out System System.out result String args[] args public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());
        sc.close();

        // 主処理
        int a = -1;
        int b = -1;
        int c = -1;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int j2 = n - (i + j);
                int total = 10000 * i + 5000 * j + 1000 * j2;
                if (total == y) {
                    a = i;
                    b = j;
                    c = j2;
                    break;
                }
            }
        }
        String result = a + " " + b + " " + c;

        // 出力
        System.out.println(result);
    }
} public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());
        sc.close();

        // 主処理
        int a = -1;
        int b = -1;
        int c = -1;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int j2 = n - (i + j);
                int total = 10000 * i + 5000 * j + 1000 * j2;
                if (total == y) {
                    a = i;
                    b = j;
                    c = j2;
                    break;
                }
            }
        }
        String result = a + " " + b + " " + c;

        // 出力
        System.out.println(result);
    }
} Main
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());
        sc.close();

        // 主処理
        int a = -1;
        int b = -1;
        int c = -1;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int j2 = n - (i + j);
                int total = 10000 * i + 5000 * j + 1000 * j2;
                if (total == y) {
                    a = i;
                    b = j;
                    c = j2;
                    break;
                }
            }
        }
        String result = a + " " + b + " " + c;

        // 出力
        System.out.println(result);
    }
}
