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 i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                int k = N - i - j;
                if (k >= 0) {
                    int sum = 10000 * i + 5000 * j + 1000 * k;
                    if (sum == Y) {
                        System.out.print(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            }
        }
        System.out.print(String.format("%d %d %d", -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 i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                int k = N - i - j;
                if (k >= 0) {
                    int sum = 10000 * i + 5000 * j + 1000 * k;
                    if (sum == Y) {
                        System.out.print(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            }
        }
        System.out.print(String.format("%d %d %d", -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 i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                int k = N - i - j;
                if (k >= 0) {
                    int sum = 10000 * i + 5000 * j + 1000 * k;
                    if (sum == Y) {
                        System.out.print(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            }
        }
        System.out.print(String.format("%d %d %d", -1, -1, -1));
    } main {
        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();
        int Y = scanner.nextInt();

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                int k = N - i - j;
                if (k >= 0) {
                    int sum = 10000 * i + 5000 * j + 1000 * k;
                    if (sum == Y) {
                        System.out.print(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            }
        }
        System.out.print(String.format("%d %d %d", -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 i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                int k = N - i - j;
                if (k >= 0) {
                    int sum = 10000 * i + 5000 * j + 1000 * k;
                    if (sum == Y) {
                        System.out.print(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            }
        } int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
            for (int j = 0; j <= N; j++) {
                int k = N - i - j;
                if (k >= 0) {
                    int sum = 10000 * i + 5000 * j + 1000 * k;
                    if (sum == Y) {
                        System.out.print(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            }
        } {
            for (int j = 0; j <= N; j++) {
                int k = N - i - j;
                if (k >= 0) {
                    int sum = 10000 * i + 5000 * j + 1000 * k;
                    if (sum == Y) {
                        System.out.print(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            }
        } for (int j = 0; j <= N; j++) {
                int k = N - i - j;
                if (k >= 0) {
                    int sum = 10000 * i + 5000 * j + 1000 * k;
                    if (sum == Y) {
                        System.out.print(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            } int j = 0; int j = 0; j 0 j <= N j N j++ j++ j {
                int k = N - i - j;
                if (k >= 0) {
                    int sum = 10000 * i + 5000 * j + 1000 * k;
                    if (sum == Y) {
                        System.out.print(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            } {
                int k = N - i - j;
                if (k >= 0) {
                    int sum = 10000 * i + 5000 * j + 1000 * k;
                    if (sum == Y) {
                        System.out.print(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            } int k = N - i - j; k N - i - j N - i - j N i j if (k >= 0) {
                    int sum = 10000 * i + 5000 * j + 1000 * k;
                    if (sum == Y) {
                        System.out.print(String.format("%d %d %d", i, j, k));
                        return;
                    }
                } k >= 0 k 0 {
                    int sum = 10000 * i + 5000 * j + 1000 * k;
                    if (sum == Y) {
                        System.out.print(String.format("%d %d %d", i, j, k));
                        return;
                    }
                } int sum = 10000 * i + 5000 * j + 1000 * k; sum 10000 * i + 5000 * j + 1000 * k 10000 * i + 5000 * j + 1000 * k 10000 * i 10000 i 5000 * j 5000 j 1000 * k 1000 k if (sum == Y) {
                        System.out.print(String.format("%d %d %d", i, j, k));
                        return;
                    } sum == Y sum Y {
                        System.out.print(String.format("%d %d %d", i, j, k));
                        return;
                    } System.out.print(String.format("%d %d %d", i, j, k)) System.out.print System.out System System.out String.format("%d %d %d", i, j, k) String.format String "%d %d %d" i j k return; System.out.print(String.format("%d %d %d", -1, -1, -1)) System.out.print System.out System System.out String.format("%d %d %d", -1, -1, -1) String.format String "%d %d %d" -1 1 -1 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 i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                int k = N - i - j;
                if (k >= 0) {
                    int sum = 10000 * i + 5000 * j + 1000 * k;
                    if (sum == Y) {
                        System.out.print(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            }
        }
        System.out.print(String.format("%d %d %d", -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 i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                int k = N - i - j;
                if (k >= 0) {
                    int sum = 10000 * i + 5000 * j + 1000 * k;
                    if (sum == Y) {
                        System.out.print(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            }
        }
        System.out.print(String.format("%d %d %d", -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 i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                int k = N - i - j;
                if (k >= 0) {
                    int sum = 10000 * i + 5000 * j + 1000 * k;
                    if (sum == Y) {
                        System.out.print(String.format("%d %d %d", i, j, k));
                        return;
                    }
                }
            }
        }
        System.out.print(String.format("%d %d %d", -1, -1, -1));
    }
}