import java.util.*;

class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        int ans = 0;

        Integer n = sc.nextInt();
        Integer y = sc.nextInt();

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int s = i * 10000 + j * 5000;
                if ((y - s) / 1000 == n - i - j) {
                    System.out.println("" + i + " " + j + " " + (y - s) / 1000);
                    sc.close();
                    return;
                }
            }
        }

        System.out.println("-1 -1 -1");
        sc.close();
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        int ans = 0;

        Integer n = sc.nextInt();
        Integer y = sc.nextInt();

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int s = i * 10000 + j * 5000;
                if ((y - s) / 1000 == n - i - j) {
                    System.out.println("" + i + " " + j + " " + (y - s) / 1000);
                    sc.close();
                    return;
                }
            }
        }

        System.out.println("-1 -1 -1");
        sc.close();
    }
} Main public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        int ans = 0;

        Integer n = sc.nextInt();
        Integer y = sc.nextInt();

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int s = i * 10000 + j * 5000;
                if ((y - s) / 1000 == n - i - j) {
                    System.out.println("" + i + " " + j + " " + (y - s) / 1000);
                    sc.close();
                    return;
                }
            }
        }

        System.out.println("-1 -1 -1");
        sc.close();
    } main {

        Scanner sc = new Scanner(System.in);

        int ans = 0;

        Integer n = sc.nextInt();
        Integer y = sc.nextInt();

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int s = i * 10000 + j * 5000;
                if ((y - s) / 1000 == n - i - j) {
                    System.out.println("" + i + " " + j + " " + (y - s) / 1000);
                    sc.close();
                    return;
                }
            }
        }

        System.out.println("-1 -1 -1");
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int ans = 0; ans 0 Integer n = sc.nextInt(); n sc.nextInt() sc.nextInt sc Integer y = sc.nextInt(); y sc.nextInt() sc.nextInt sc for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int s = i * 10000 + j * 5000;
                if ((y - s) / 1000 == n - i - j) {
                    System.out.println("" + i + " " + j + " " + (y - s) / 1000);
                    sc.close();
                    return;
                }
            }
        } int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
            for (int j = 0; j <= n - i; j++) {
                int s = i * 10000 + j * 5000;
                if ((y - s) / 1000 == n - i - j) {
                    System.out.println("" + i + " " + j + " " + (y - s) / 1000);
                    sc.close();
                    return;
                }
            }
        } {
            for (int j = 0; j <= n - i; j++) {
                int s = i * 10000 + j * 5000;
                if ((y - s) / 1000 == n - i - j) {
                    System.out.println("" + i + " " + j + " " + (y - s) / 1000);
                    sc.close();
                    return;
                }
            }
        } for (int j = 0; j <= n - i; j++) {
                int s = i * 10000 + j * 5000;
                if ((y - s) / 1000 == n - i - j) {
                    System.out.println("" + i + " " + j + " " + (y - s) / 1000);
                    sc.close();
                    return;
                }
            } int j = 0; int j = 0; j 0 j <= n - i j n - i n i j++ j++ j {
                int s = i * 10000 + j * 5000;
                if ((y - s) / 1000 == n - i - j) {
                    System.out.println("" + i + " " + j + " " + (y - s) / 1000);
                    sc.close();
                    return;
                }
            } {
                int s = i * 10000 + j * 5000;
                if ((y - s) / 1000 == n - i - j) {
                    System.out.println("" + i + " " + j + " " + (y - s) / 1000);
                    sc.close();
                    return;
                }
            } int s = i * 10000 + j * 5000; s i * 10000 + j * 5000 i * 10000 i 10000 j * 5000 j 5000 if ((y - s) / 1000 == n - i - j) {
                    System.out.println("" + i + " " + j + " " + (y - s) / 1000);
                    sc.close();
                    return;
                } (y - s) / 1000 == n - i - j (y - s) / 1000 (y - s) y s 1000 n - i - j n - i - j n i j {
                    System.out.println("" + i + " " + j + " " + (y - s) / 1000);
                    sc.close();
                    return;
                } System.out.println("" + i + " " + j + " " + (y - s) / 1000) System.out.println System.out System System.out "" + i + " " + j + " " + (y - s) / 1000 " " j " " "" + i + " " + j + " " + (y - s) / 1000 "" i " " j " " (y - s) / 1000 (y - s) y s 1000 sc.close() sc.close sc return; System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" sc.close() sc.close sc String[] args args
import java.util.*;

class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        int ans = 0;

        Integer n = sc.nextInt();
        Integer y = sc.nextInt();

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int s = i * 10000 + j * 5000;
                if ((y - s) / 1000 == n - i - j) {
                    System.out.println("" + i + " " + j + " " + (y - s) / 1000);
                    sc.close();
                    return;
                }
            }
        }

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