import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int m = -1, f = -1, t = -1;
        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                if (i + j <= N) {
                    int k = N - i - j;
                    if (i + j + k == N) {
                        if (10000 * i + 5000 * j + 1000 * k == Y) {
                            m = i;
                            f = j;
                            t = k;
                        }
                    }
                }

            }
        }
        System.out.println(m + " " + f + " " + t);

        // List<Integer> list = new ArrayList<>();
        // for (int i = 0; i < N; i++) {
        // list.add(sc.nextInt());
        // }
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int m = -1, f = -1, t = -1;
        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                if (i + j <= N) {
                    int k = N - i - j;
                    if (i + j + k == N) {
                        if (10000 * i + 5000 * j + 1000 * k == Y) {
                            m = i;
                            f = j;
                            t = k;
                        }
                    }
                }

            }
        }
        System.out.println(m + " " + f + " " + t);

        // List<Integer> list = new ArrayList<>();
        // for (int i = 0; i < N; i++) {
        // list.add(sc.nextInt());
        // }
    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int m = -1, f = -1, t = -1;
        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                if (i + j <= N) {
                    int k = N - i - j;
                    if (i + j + k == N) {
                        if (10000 * i + 5000 * j + 1000 * k == Y) {
                            m = i;
                            f = j;
                            t = k;
                        }
                    }
                }

            }
        }
        System.out.println(m + " " + f + " " + t);

        // List<Integer> list = new ArrayList<>();
        // for (int i = 0; i < N; i++) {
        // list.add(sc.nextInt());
        // }
    } main {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int m = -1, f = -1, t = -1;
        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                if (i + j <= N) {
                    int k = N - i - j;
                    if (i + j + k == N) {
                        if (10000 * i + 5000 * j + 1000 * k == Y) {
                            m = i;
                            f = j;
                            t = k;
                        }
                    }
                }

            }
        }
        System.out.println(m + " " + f + " " + t);

        // List<Integer> list = new ArrayList<>();
        // for (int i = 0; i < N; i++) {
        // list.add(sc.nextInt());
        // }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int Y = sc.nextInt(); Y sc.nextInt() sc.nextInt sc int m = -1 m -1 1 f = -1 f -1 1 t = -1; t -1 1 for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                if (i + j <= N) {
                    int k = N - i - j;
                    if (i + j + k == N) {
                        if (10000 * i + 5000 * j + 1000 * k == Y) {
                            m = i;
                            f = j;
                            t = k;
                        }
                    }
                }

            }
        } int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
            for (int j = 0; j <= N; j++) {
                if (i + j <= N) {
                    int k = N - i - j;
                    if (i + j + k == N) {
                        if (10000 * i + 5000 * j + 1000 * k == Y) {
                            m = i;
                            f = j;
                            t = k;
                        }
                    }
                }

            }
        } {
            for (int j = 0; j <= N; j++) {
                if (i + j <= N) {
                    int k = N - i - j;
                    if (i + j + k == N) {
                        if (10000 * i + 5000 * j + 1000 * k == Y) {
                            m = i;
                            f = j;
                            t = k;
                        }
                    }
                }

            }
        } for (int j = 0; j <= N; j++) {
                if (i + j <= N) {
                    int k = N - i - j;
                    if (i + j + k == N) {
                        if (10000 * i + 5000 * j + 1000 * k == Y) {
                            m = i;
                            f = j;
                            t = k;
                        }
                    }
                }

            } int j = 0; int j = 0; j 0 j <= N j N j++ j++ j {
                if (i + j <= N) {
                    int k = N - i - j;
                    if (i + j + k == N) {
                        if (10000 * i + 5000 * j + 1000 * k == Y) {
                            m = i;
                            f = j;
                            t = k;
                        }
                    }
                }

            } {
                if (i + j <= N) {
                    int k = N - i - j;
                    if (i + j + k == N) {
                        if (10000 * i + 5000 * j + 1000 * k == Y) {
                            m = i;
                            f = j;
                            t = k;
                        }
                    }
                }

            } if (i + j <= N) {
                    int k = N - i - j;
                    if (i + j + k == N) {
                        if (10000 * i + 5000 * j + 1000 * k == Y) {
                            m = i;
                            f = j;
                            t = k;
                        }
                    }
                } i + j <= N i + j i j N {
                    int k = N - i - j;
                    if (i + j + k == N) {
                        if (10000 * i + 5000 * j + 1000 * k == Y) {
                            m = i;
                            f = j;
                            t = k;
                        }
                    }
                } int k = N - i - j; k N - i - j N - i - j N i j if (i + j + k == N) {
                        if (10000 * i + 5000 * j + 1000 * k == Y) {
                            m = i;
                            f = j;
                            t = k;
                        }
                    } i + j + k == N i + j + k i + j + k i j k N {
                        if (10000 * i + 5000 * j + 1000 * k == Y) {
                            m = i;
                            f = j;
                            t = k;
                        }
                    } if (10000 * i + 5000 * j + 1000 * k == Y) {
                            m = i;
                            f = j;
                            t = k;
                        } 10000 * i + 5000 * j + 1000 * k == Y 10000 * i + 5000 * j + 1000 * k 10000 * i + 5000 * j + 1000 * k 10000 * i 10000 i 5000 * j 5000 j 1000 * k 1000 k Y {
                            m = i;
                            f = j;
                            t = k;
                        } m = i m i f = j f j t = k t k System.out.println(m + " " + f + " " + t) System.out.println System.out System System.out m + " " + f + " " + t " " f m + " " + f + " " + t m " " f " " t String[] args args public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int m = -1, f = -1, t = -1;
        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                if (i + j <= N) {
                    int k = N - i - j;
                    if (i + j + k == N) {
                        if (10000 * i + 5000 * j + 1000 * k == Y) {
                            m = i;
                            f = j;
                            t = k;
                        }
                    }
                }

            }
        }
        System.out.println(m + " " + f + " " + t);

        // List<Integer> list = new ArrayList<>();
        // for (int i = 0; i < N; i++) {
        // list.add(sc.nextInt());
        // }
    }
} public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int m = -1, f = -1, t = -1;
        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                if (i + j <= N) {
                    int k = N - i - j;
                    if (i + j + k == N) {
                        if (10000 * i + 5000 * j + 1000 * k == Y) {
                            m = i;
                            f = j;
                            t = k;
                        }
                    }
                }

            }
        }
        System.out.println(m + " " + f + " " + t);

        // List<Integer> list = new ArrayList<>();
        // for (int i = 0; i < N; i++) {
        // list.add(sc.nextInt());
        // }
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int m = -1, f = -1, t = -1;
        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                if (i + j <= N) {
                    int k = N - i - j;
                    if (i + j + k == N) {
                        if (10000 * i + 5000 * j + 1000 * k == Y) {
                            m = i;
                            f = j;
                            t = k;
                        }
                    }
                }

            }
        }
        System.out.println(m + " " + f + " " + t);

        // List<Integer> list = new ArrayList<>();
        // for (int i = 0; i < N; i++) {
        // list.add(sc.nextInt());
        // }
    }
}