import java.util.Scanner;

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

        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int Y = scan.nextInt();

        for (int x = 0; x < n + 1; x++) {
            for (int y = 0; x + y < n + 1; y++) {
                int z = n - x - y;
                if (10000 * x + 5000 * y + 1000 * z == Y) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int Y = scan.nextInt();

        for (int x = 0; x < n + 1; x++) {
            for (int y = 0; x + y < n + 1; y++) {
                int z = n - x - y;
                if (10000 * x + 5000 * y + 1000 * z == Y) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
} Main public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int Y = scan.nextInt();

        for (int x = 0; x < n + 1; x++) {
            for (int y = 0; x + y < n + 1; y++) {
                int z = n - x - y;
                if (10000 * x + 5000 * y + 1000 * z == Y) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    } main {

        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int Y = scan.nextInt();

        for (int x = 0; x < n + 1; x++) {
            for (int y = 0; x + y < n + 1; y++) {
                int z = n - x - y;
                if (10000 * x + 5000 * y + 1000 * z == Y) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int Y = scan.nextInt(); Y scan.nextInt() scan.nextInt scan for (int x = 0; x < n + 1; x++) {
            for (int y = 0; x + y < n + 1; y++) {
                int z = n - x - y;
                if (10000 * x + 5000 * y + 1000 * z == Y) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        } int x = 0; int x = 0; x 0 x < n + 1 x n + 1 n 1 x++ x++ x {
            for (int y = 0; x + y < n + 1; y++) {
                int z = n - x - y;
                if (10000 * x + 5000 * y + 1000 * z == Y) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        } {
            for (int y = 0; x + y < n + 1; y++) {
                int z = n - x - y;
                if (10000 * x + 5000 * y + 1000 * z == Y) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        } for (int y = 0; x + y < n + 1; y++) {
                int z = n - x - y;
                if (10000 * x + 5000 * y + 1000 * z == Y) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            } int y = 0; int y = 0; y 0 x + y < n + 1 x + y x y n + 1 n 1 y++ y++ y {
                int z = n - x - y;
                if (10000 * x + 5000 * y + 1000 * z == Y) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            } {
                int z = n - x - y;
                if (10000 * x + 5000 * y + 1000 * z == Y) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            } int z = n - x - y; z n - x - y n - x - y n x y if (10000 * x + 5000 * y + 1000 * z == Y) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                } 10000 * x + 5000 * y + 1000 * z == Y 10000 * x + 5000 * y + 1000 * z 10000 * x + 5000 * y + 1000 * z 10000 * x 10000 x 5000 * y 5000 y 1000 * z 1000 z Y {
                    System.out.println(x + " " + y + " " + z);
                    return;
                } System.out.println(x + " " + y + " " + z) System.out.println System.out System System.out x + " " + y + " " + z " " y x + " " + y + " " + z x " " y " " z return; System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" String[] args args
import java.util.Scanner;

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

        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int Y = scan.nextInt();

        for (int x = 0; x < n + 1; x++) {
            for (int y = 0; x + y < n + 1; y++) {
                int z = n - x - y;
                if (10000 * x + 5000 * y + 1000 * z == Y) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
}