import java.util.Scanner;

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

        for (int a = 0; a <= n; a++) {
            for (int b = 0; b <= n; b++) {
                if (n - a - b < 0) {
                    continue;
                }

                if (10000 * a + 5000 * b + 1000 * (n - a - b) == y) {
                    System.out.println(
                            String.format("%d %d %d", a, b, (n - a - b))
                    );
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
}
 import java.util.Scanner; Scanner java.util public class Main
{
    public static void main(String[] args)
    {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int y = scanner.nextInt();

        for (int a = 0; a <= n; a++) {
            for (int b = 0; b <= n; b++) {
                if (n - a - b < 0) {
                    continue;
                }

                if (10000 * a + 5000 * b + 1000 * (n - a - b) == y) {
                    System.out.println(
                            String.format("%d %d %d", a, b, (n - a - b))
                    );
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
} Main public static void main(String[] args)
    {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int y = scanner.nextInt();

        for (int a = 0; a <= n; a++) {
            for (int b = 0; b <= n; b++) {
                if (n - a - b < 0) {
                    continue;
                }

                if (10000 * a + 5000 * b + 1000 * (n - a - b) == y) {
                    System.out.println(
                            String.format("%d %d %d", a, b, (n - a - b))
                    );
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    } main {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int y = scanner.nextInt();

        for (int a = 0; a <= n; a++) {
            for (int b = 0; b <= n; b++) {
                if (n - a - b < 0) {
                    continue;
                }

                if (10000 * a + 5000 * b + 1000 * (n - a - b) == y) {
                    System.out.println(
                            String.format("%d %d %d", a, b, (n - a - b))
                    );
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int y = scanner.nextInt(); y scanner.nextInt() scanner.nextInt scanner for (int a = 0; a <= n; a++) {
            for (int b = 0; b <= n; b++) {
                if (n - a - b < 0) {
                    continue;
                }

                if (10000 * a + 5000 * b + 1000 * (n - a - b) == y) {
                    System.out.println(
                            String.format("%d %d %d", a, b, (n - a - b))
                    );
                    return;
                }
            }
        } int a = 0; int a = 0; a 0 a <= n a n a++ a++ a {
            for (int b = 0; b <= n; b++) {
                if (n - a - b < 0) {
                    continue;
                }

                if (10000 * a + 5000 * b + 1000 * (n - a - b) == y) {
                    System.out.println(
                            String.format("%d %d %d", a, b, (n - a - b))
                    );
                    return;
                }
            }
        } {
            for (int b = 0; b <= n; b++) {
                if (n - a - b < 0) {
                    continue;
                }

                if (10000 * a + 5000 * b + 1000 * (n - a - b) == y) {
                    System.out.println(
                            String.format("%d %d %d", a, b, (n - a - b))
                    );
                    return;
                }
            }
        } for (int b = 0; b <= n; b++) {
                if (n - a - b < 0) {
                    continue;
                }

                if (10000 * a + 5000 * b + 1000 * (n - a - b) == y) {
                    System.out.println(
                            String.format("%d %d %d", a, b, (n - a - b))
                    );
                    return;
                }
            } int b = 0; int b = 0; b 0 b <= n b n b++ b++ b {
                if (n - a - b < 0) {
                    continue;
                }

                if (10000 * a + 5000 * b + 1000 * (n - a - b) == y) {
                    System.out.println(
                            String.format("%d %d %d", a, b, (n - a - b))
                    );
                    return;
                }
            } {
                if (n - a - b < 0) {
                    continue;
                }

                if (10000 * a + 5000 * b + 1000 * (n - a - b) == y) {
                    System.out.println(
                            String.format("%d %d %d", a, b, (n - a - b))
                    );
                    return;
                }
            } if (n - a - b < 0) {
                    continue;
                } n - a - b < 0 n - a - b n - a - b n a b 0 {
                    continue;
                } continue; if (10000 * a + 5000 * b + 1000 * (n - a - b) == y) {
                    System.out.println(
                            String.format("%d %d %d", a, b, (n - a - b))
                    );
                    return;
                } 10000 * a + 5000 * b + 1000 * (n - a - b) == y 10000 * a + 5000 * b + 1000 * (n - a - b) 10000 * a + 5000 * b + 1000 * (n - a - b) 10000 * a 10000 a 5000 * b 5000 b 1000 * (n - a - b) 1000 (n - a - b) n - a - b n a b y {
                    System.out.println(
                            String.format("%d %d %d", a, b, (n - a - b))
                    );
                    return;
                } System.out.println(
                            String.format("%d %d %d", a, b, (n - a - b))
                    ) System.out.println System.out System System.out String.format("%d %d %d", a, b, (n - a - b)) String.format String "%d %d %d" a b (n - a - b) n - a - b n a b return; System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" String[] args args public class Main
{
    public static void main(String[] args)
    {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int y = scanner.nextInt();

        for (int a = 0; a <= n; a++) {
            for (int b = 0; b <= n; b++) {
                if (n - a - b < 0) {
                    continue;
                }

                if (10000 * a + 5000 * b + 1000 * (n - a - b) == y) {
                    System.out.println(
                            String.format("%d %d %d", a, b, (n - a - b))
                    );
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
} public class Main
{
    public static void main(String[] args)
    {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int y = scanner.nextInt();

        for (int a = 0; a <= n; a++) {
            for (int b = 0; b <= n; b++) {
                if (n - a - b < 0) {
                    continue;
                }

                if (10000 * a + 5000 * b + 1000 * (n - a - b) == y) {
                    System.out.println(
                            String.format("%d %d %d", a, b, (n - a - b))
                    );
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
} Main
import java.util.Scanner;

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

        for (int a = 0; a <= n; a++) {
            for (int b = 0; b <= n; b++) {
                if (n - a - b < 0) {
                    continue;
                }

                if (10000 * a + 5000 * b + 1000 * (n - a - b) == y) {
                    System.out.println(
                            String.format("%d %d %d", a, b, (n - a - b))
                    );
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
}

