import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int N = cin.nextInt();
        long Y = cin.nextLong();

        int x = -1, y = -1, z = -1;

        loop:
        for (int a = 0; a <= N; a++) {
            for (int b = 0; b <= N - a; b++) {
                int c = N - a - b;
                if (10000 * a + 5000 * b + 1000 * c == Y) {
                    x = a;
                    y = b;
                    z = c;
                    break loop;
                }
            }
        }

        System.out.printf("%d %d %d\n", x, y, z);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int N = cin.nextInt();
        long Y = cin.nextLong();

        int x = -1, y = -1, z = -1;

        loop:
        for (int a = 0; a <= N; a++) {
            for (int b = 0; b <= N - a; b++) {
                int c = N - a - b;
                if (10000 * a + 5000 * b + 1000 * c == Y) {
                    x = a;
                    y = b;
                    z = c;
                    break loop;
                }
            }
        }

        System.out.printf("%d %d %d\n", x, y, z);
    }
} Main public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int N = cin.nextInt();
        long Y = cin.nextLong();

        int x = -1, y = -1, z = -1;

        loop:
        for (int a = 0; a <= N; a++) {
            for (int b = 0; b <= N - a; b++) {
                int c = N - a - b;
                if (10000 * a + 5000 * b + 1000 * c == Y) {
                    x = a;
                    y = b;
                    z = c;
                    break loop;
                }
            }
        }

        System.out.printf("%d %d %d\n", x, y, z);
    } main {
        Scanner cin = new Scanner(System.in);
        int N = cin.nextInt();
        long Y = cin.nextLong();

        int x = -1, y = -1, z = -1;

        loop:
        for (int a = 0; a <= N; a++) {
            for (int b = 0; b <= N - a; b++) {
                int c = N - a - b;
                if (10000 * a + 5000 * b + 1000 * c == Y) {
                    x = a;
                    y = b;
                    z = c;
                    break loop;
                }
            }
        }

        System.out.printf("%d %d %d\n", x, y, z);
    } Scanner cin = new Scanner(System.in); cin new Scanner(System.in) int N = cin.nextInt(); N cin.nextInt() cin.nextInt cin long Y = cin.nextLong(); Y cin.nextLong() cin.nextLong cin int x = -1 x -1 1 y = -1 y -1 1 z = -1; z -1 1 System.out.printf("%d %d %d\n", x, y, z) System.out.printf System.out System System.out "%d %d %d\n" x y z String[] args args public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int N = cin.nextInt();
        long Y = cin.nextLong();

        int x = -1, y = -1, z = -1;

        loop:
        for (int a = 0; a <= N; a++) {
            for (int b = 0; b <= N - a; b++) {
                int c = N - a - b;
                if (10000 * a + 5000 * b + 1000 * c == Y) {
                    x = a;
                    y = b;
                    z = c;
                    break loop;
                }
            }
        }

        System.out.printf("%d %d %d\n", x, y, z);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int N = cin.nextInt();
        long Y = cin.nextLong();

        int x = -1, y = -1, z = -1;

        loop:
        for (int a = 0; a <= N; a++) {
            for (int b = 0; b <= N - a; b++) {
                int c = N - a - b;
                if (10000 * a + 5000 * b + 1000 * c == Y) {
                    x = a;
                    y = b;
                    z = c;
                    break loop;
                }
            }
        }

        System.out.printf("%d %d %d\n", x, y, z);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int N = cin.nextInt();
        long Y = cin.nextLong();

        int x = -1, y = -1, z = -1;

        loop:
        for (int a = 0; a <= N; a++) {
            for (int b = 0; b <= N - a; b++) {
                int c = N - a - b;
                if (10000 * a + 5000 * b + 1000 * c == Y) {
                    x = a;
                    y = b;
                    z = c;
                    break loop;
                }
            }
        }

        System.out.printf("%d %d %d\n", x, y, z);
    }
}