import java.util.Scanner;

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

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int totalYen = i * 10000 + j * 5000 + (n - i - j) * 1000;
                if (totalYen == y) {
                    System.out.print(i + " " + j + " " + (n - i - j));
                    return;
                }
            }
        }

        System.out.println("-1 -1 -1");
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int y = in.nextInt();

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int totalYen = i * 10000 + j * 5000 + (n - i - j) * 1000;
                if (totalYen == y) {
                    System.out.print(i + " " + j + " " + (n - i - j));
                    return;
                }
            }
        }

        System.out.println("-1 -1 -1");
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int y = in.nextInt();

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int totalYen = i * 10000 + j * 5000 + (n - i - j) * 1000;
                if (totalYen == y) {
                    System.out.print(i + " " + j + " " + (n - i - j));
                    return;
                }
            }
        }

        System.out.println("-1 -1 -1");
    } main {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int y = in.nextInt();

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int totalYen = i * 10000 + j * 5000 + (n - i - j) * 1000;
                if (totalYen == y) {
                    System.out.print(i + " " + j + " " + (n - i - j));
                    return;
                }
            }
        }

        System.out.println("-1 -1 -1");
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int y = in.nextInt(); y in.nextInt() in.nextInt in for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int totalYen = i * 10000 + j * 5000 + (n - i - j) * 1000;
                if (totalYen == y) {
                    System.out.print(i + " " + j + " " + (n - i - j));
                    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 totalYen = i * 10000 + j * 5000 + (n - i - j) * 1000;
                if (totalYen == y) {
                    System.out.print(i + " " + j + " " + (n - i - j));
                    return;
                }
            }
        } {
            for (int j = 0; j <= n - i; j++) {
                int totalYen = i * 10000 + j * 5000 + (n - i - j) * 1000;
                if (totalYen == y) {
                    System.out.print(i + " " + j + " " + (n - i - j));
                    return;
                }
            }
        } for (int j = 0; j <= n - i; j++) {
                int totalYen = i * 10000 + j * 5000 + (n - i - j) * 1000;
                if (totalYen == y) {
                    System.out.print(i + " " + j + " " + (n - i - j));
                    return;
                }
            } int j = 0; int j = 0; j 0 j <= n - i j n - i n i j++ j++ j {
                int totalYen = i * 10000 + j * 5000 + (n - i - j) * 1000;
                if (totalYen == y) {
                    System.out.print(i + " " + j + " " + (n - i - j));
                    return;
                }
            } {
                int totalYen = i * 10000 + j * 5000 + (n - i - j) * 1000;
                if (totalYen == y) {
                    System.out.print(i + " " + j + " " + (n - i - j));
                    return;
                }
            } int totalYen = i * 10000 + j * 5000 + (n - i - j) * 1000; totalYen i * 10000 + j * 5000 + (n - i - j) * 1000 i * 10000 + j * 5000 + (n - i - j) * 1000 i * 10000 i 10000 j * 5000 j 5000 (n - i - j) * 1000 (n - i - j) n - i - j n i j 1000 if (totalYen == y) {
                    System.out.print(i + " " + j + " " + (n - i - j));
                    return;
                } totalYen == y totalYen y {
                    System.out.print(i + " " + j + " " + (n - i - j));
                    return;
                } System.out.print(i + " " + j + " " + (n - i - j)) System.out.print System.out System System.out i + " " + j + " " + (n - i - j) " " j i + " " + j + " " + (n - i - j) i " " j " " (n - i - j) n - i - j n i j 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 in = new Scanner(System.in);
        int n = in.nextInt();
        int y = in.nextInt();

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int totalYen = i * 10000 + j * 5000 + (n - i - j) * 1000;
                if (totalYen == y) {
                    System.out.print(i + " " + j + " " + (n - i - j));
                    return;
                }
            }
        }

        System.out.println("-1 -1 -1");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int y = in.nextInt();

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int totalYen = i * 10000 + j * 5000 + (n - i - j) * 1000;
                if (totalYen == y) {
                    System.out.print(i + " " + j + " " + (n - i - j));
                    return;
                }
            }
        }

        System.out.println("-1 -1 -1");
    }
} Main
import java.util.Scanner;

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

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int totalYen = i * 10000 + j * 5000 + (n - i - j) * 1000;
                if (totalYen == y) {
                    System.out.print(i + " " + j + " " + (n - i - j));
                    return;
                }
            }
        }

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