
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();

        int sum1, sum2, sum3;
        for (int s=N; s >= 0; s--) {
            // 10,000
            sum1 = 10000 * s;
            if (sum1 > Y) {
                continue;
            }
            for (int t=N - s; t >= 0; t--) {
                // 5,000
                sum2 = 5000 * t;
                if (sum1 + sum2 > Y) {
                    continue;
                }

                // 1,000
                int u = N - s - t;
                sum3 = 1000 * u;
                if (s + t + u == N) {
                    if (sum1 + sum2 + sum3 == Y) {
                        System.out.printf("%d %d %d\n", s, t, u);
                        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();

        int sum1, sum2, sum3;
        for (int s=N; s >= 0; s--) {
            // 10,000
            sum1 = 10000 * s;
            if (sum1 > Y) {
                continue;
            }
            for (int t=N - s; t >= 0; t--) {
                // 5,000
                sum2 = 5000 * t;
                if (sum1 + sum2 > Y) {
                    continue;
                }

                // 1,000
                int u = N - s - t;
                sum3 = 1000 * u;
                if (s + t + u == N) {
                    if (sum1 + sum2 + sum3 == Y) {
                        System.out.printf("%d %d %d\n", s, t, u);
                        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();

        int sum1, sum2, sum3;
        for (int s=N; s >= 0; s--) {
            // 10,000
            sum1 = 10000 * s;
            if (sum1 > Y) {
                continue;
            }
            for (int t=N - s; t >= 0; t--) {
                // 5,000
                sum2 = 5000 * t;
                if (sum1 + sum2 > Y) {
                    continue;
                }

                // 1,000
                int u = N - s - t;
                sum3 = 1000 * u;
                if (s + t + u == N) {
                    if (sum1 + sum2 + sum3 == Y) {
                        System.out.printf("%d %d %d\n", s, t, u);
                        return;
                    }
                }
            }
        }
        System.out.println("-1 -1 -1");
    } main {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int Y = scanner.nextInt();

        int sum1, sum2, sum3;
        for (int s=N; s >= 0; s--) {
            // 10,000
            sum1 = 10000 * s;
            if (sum1 > Y) {
                continue;
            }
            for (int t=N - s; t >= 0; t--) {
                // 5,000
                sum2 = 5000 * t;
                if (sum1 + sum2 > Y) {
                    continue;
                }

                // 1,000
                int u = N - s - t;
                sum3 = 1000 * u;
                if (s + t + u == N) {
                    if (sum1 + sum2 + sum3 == Y) {
                        System.out.printf("%d %d %d\n", s, t, u);
                        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 int sum1 sum1 sum2 sum2 sum3; sum3 for (int s=N; s >= 0; s--) {
            // 10,000
            sum1 = 10000 * s;
            if (sum1 > Y) {
                continue;
            }
            for (int t=N - s; t >= 0; t--) {
                // 5,000
                sum2 = 5000 * t;
                if (sum1 + sum2 > Y) {
                    continue;
                }

                // 1,000
                int u = N - s - t;
                sum3 = 1000 * u;
                if (s + t + u == N) {
                    if (sum1 + sum2 + sum3 == Y) {
                        System.out.printf("%d %d %d\n", s, t, u);
                        return;
                    }
                }
            }
        } int s=N; int s=N; s N s >= 0 s 0 s-- s-- s {
            // 10,000
            sum1 = 10000 * s;
            if (sum1 > Y) {
                continue;
            }
            for (int t=N - s; t >= 0; t--) {
                // 5,000
                sum2 = 5000 * t;
                if (sum1 + sum2 > Y) {
                    continue;
                }

                // 1,000
                int u = N - s - t;
                sum3 = 1000 * u;
                if (s + t + u == N) {
                    if (sum1 + sum2 + sum3 == Y) {
                        System.out.printf("%d %d %d\n", s, t, u);
                        return;
                    }
                }
            }
        } {
            // 10,000
            sum1 = 10000 * s;
            if (sum1 > Y) {
                continue;
            }
            for (int t=N - s; t >= 0; t--) {
                // 5,000
                sum2 = 5000 * t;
                if (sum1 + sum2 > Y) {
                    continue;
                }

                // 1,000
                int u = N - s - t;
                sum3 = 1000 * u;
                if (s + t + u == N) {
                    if (sum1 + sum2 + sum3 == Y) {
                        System.out.printf("%d %d %d\n", s, t, u);
                        return;
                    }
                }
            }
        } sum1 = 10000 * s sum1 10000 * s 10000 s if (sum1 > Y) {
                continue;
            } sum1 > Y sum1 Y {
                continue;
            } continue; for (int t=N - s; t >= 0; t--) {
                // 5,000
                sum2 = 5000 * t;
                if (sum1 + sum2 > Y) {
                    continue;
                }

                // 1,000
                int u = N - s - t;
                sum3 = 1000 * u;
                if (s + t + u == N) {
                    if (sum1 + sum2 + sum3 == Y) {
                        System.out.printf("%d %d %d\n", s, t, u);
                        return;
                    }
                }
            } int t=N - s; int t=N - s; t N - s N s t >= 0 t 0 t-- t-- t {
                // 5,000
                sum2 = 5000 * t;
                if (sum1 + sum2 > Y) {
                    continue;
                }

                // 1,000
                int u = N - s - t;
                sum3 = 1000 * u;
                if (s + t + u == N) {
                    if (sum1 + sum2 + sum3 == Y) {
                        System.out.printf("%d %d %d\n", s, t, u);
                        return;
                    }
                }
            } {
                // 5,000
                sum2 = 5000 * t;
                if (sum1 + sum2 > Y) {
                    continue;
                }

                // 1,000
                int u = N - s - t;
                sum3 = 1000 * u;
                if (s + t + u == N) {
                    if (sum1 + sum2 + sum3 == Y) {
                        System.out.printf("%d %d %d\n", s, t, u);
                        return;
                    }
                }
            } sum2 = 5000 * t sum2 5000 * t 5000 t if (sum1 + sum2 > Y) {
                    continue;
                } sum1 + sum2 > Y sum1 + sum2 sum1 sum2 Y {
                    continue;
                } continue; int u = N - s - t; u N - s - t N - s - t N s t sum3 = 1000 * u sum3 1000 * u 1000 u if (s + t + u == N) {
                    if (sum1 + sum2 + sum3 == Y) {
                        System.out.printf("%d %d %d\n", s, t, u);
                        return;
                    }
                } s + t + u == N s + t + u s + t + u s t u N {
                    if (sum1 + sum2 + sum3 == Y) {
                        System.out.printf("%d %d %d\n", s, t, u);
                        return;
                    }
                } if (sum1 + sum2 + sum3 == Y) {
                        System.out.printf("%d %d %d\n", s, t, u);
                        return;
                    } sum1 + sum2 + sum3 == Y sum1 + sum2 + sum3 sum1 + sum2 + sum3 sum1 sum2 sum3 Y {
                        System.out.printf("%d %d %d\n", s, t, u);
                        return;
                    } System.out.printf("%d %d %d\n", s, t, u) System.out.printf System.out System System.out "%d %d %d\n" s t u 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();

        int sum1, sum2, sum3;
        for (int s=N; s >= 0; s--) {
            // 10,000
            sum1 = 10000 * s;
            if (sum1 > Y) {
                continue;
            }
            for (int t=N - s; t >= 0; t--) {
                // 5,000
                sum2 = 5000 * t;
                if (sum1 + sum2 > Y) {
                    continue;
                }

                // 1,000
                int u = N - s - t;
                sum3 = 1000 * u;
                if (s + t + u == N) {
                    if (sum1 + sum2 + sum3 == Y) {
                        System.out.printf("%d %d %d\n", s, t, u);
                        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();

        int sum1, sum2, sum3;
        for (int s=N; s >= 0; s--) {
            // 10,000
            sum1 = 10000 * s;
            if (sum1 > Y) {
                continue;
            }
            for (int t=N - s; t >= 0; t--) {
                // 5,000
                sum2 = 5000 * t;
                if (sum1 + sum2 > Y) {
                    continue;
                }

                // 1,000
                int u = N - s - t;
                sum3 = 1000 * u;
                if (s + t + u == N) {
                    if (sum1 + sum2 + sum3 == Y) {
                        System.out.printf("%d %d %d\n", s, t, u);
                        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();

        int sum1, sum2, sum3;
        for (int s=N; s >= 0; s--) {
            // 10,000
            sum1 = 10000 * s;
            if (sum1 > Y) {
                continue;
            }
            for (int t=N - s; t >= 0; t--) {
                // 5,000
                sum2 = 5000 * t;
                if (sum1 + sum2 > Y) {
                    continue;
                }

                // 1,000
                int u = N - s - t;
                sum3 = 1000 * u;
                if (s + t + u == N) {
                    if (sum1 + sum2 + sum3 == Y) {
                        System.out.printf("%d %d %d\n", s, t, u);
                        return;
                    }
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
}