import java.util.*;

public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long Y = sc.nextLong();
        sc.close();

        long num_10000 = -1;
        long num_5000 = -1;
        long num_1000 = -1;

        long target = Y - 1000 * N;
        long tmp = -1;

        for (int i = 0; i <= N; i++) {
            if ((target - 9000 * i) % 4000 == 0) {
                tmp = (target - 9000 * i) / 4000;
                if ((tmp >= 0) && (N - tmp - i) >= 0) {
                    num_10000 = i;
                    num_5000 = tmp;
                    num_1000 = N - num_10000 - num_5000;
                    break;
                }
            }
        }

        System.out.println(num_10000 + " " + num_5000 + " " + num_1000);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long Y = sc.nextLong();
        sc.close();

        long num_10000 = -1;
        long num_5000 = -1;
        long num_1000 = -1;

        long target = Y - 1000 * N;
        long tmp = -1;

        for (int i = 0; i <= N; i++) {
            if ((target - 9000 * i) % 4000 == 0) {
                tmp = (target - 9000 * i) / 4000;
                if ((tmp >= 0) && (N - tmp - i) >= 0) {
                    num_10000 = i;
                    num_5000 = tmp;
                    num_1000 = N - num_10000 - num_5000;
                    break;
                }
            }
        }

        System.out.println(num_10000 + " " + num_5000 + " " + num_1000);
    }
} Main public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long Y = sc.nextLong();
        sc.close();

        long num_10000 = -1;
        long num_5000 = -1;
        long num_1000 = -1;

        long target = Y - 1000 * N;
        long tmp = -1;

        for (int i = 0; i <= N; i++) {
            if ((target - 9000 * i) % 4000 == 0) {
                tmp = (target - 9000 * i) / 4000;
                if ((tmp >= 0) && (N - tmp - i) >= 0) {
                    num_10000 = i;
                    num_5000 = tmp;
                    num_1000 = N - num_10000 - num_5000;
                    break;
                }
            }
        }

        System.out.println(num_10000 + " " + num_5000 + " " + num_1000);
    } main {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long Y = sc.nextLong();
        sc.close();

        long num_10000 = -1;
        long num_5000 = -1;
        long num_1000 = -1;

        long target = Y - 1000 * N;
        long tmp = -1;

        for (int i = 0; i <= N; i++) {
            if ((target - 9000 * i) % 4000 == 0) {
                tmp = (target - 9000 * i) / 4000;
                if ((tmp >= 0) && (N - tmp - i) >= 0) {
                    num_10000 = i;
                    num_5000 = tmp;
                    num_1000 = N - num_10000 - num_5000;
                    break;
                }
            }
        }

        System.out.println(num_10000 + " " + num_5000 + " " + num_1000);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long N = sc.nextLong(); N sc.nextLong() sc.nextLong sc long Y = sc.nextLong(); Y sc.nextLong() sc.nextLong sc sc.close() sc.close sc long num_10000 = -1; num_10000 -1 1 long num_5000 = -1; num_5000 -1 1 long num_1000 = -1; num_1000 -1 1 long target = Y - 1000 * N; target Y - 1000 * N Y 1000 * N 1000 N long tmp = -1; tmp -1 1 for (int i = 0; i <= N; i++) {
            if ((target - 9000 * i) % 4000 == 0) {
                tmp = (target - 9000 * i) / 4000;
                if ((tmp >= 0) && (N - tmp - i) >= 0) {
                    num_10000 = i;
                    num_5000 = tmp;
                    num_1000 = N - num_10000 - num_5000;
                    break;
                }
            }
        } int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
            if ((target - 9000 * i) % 4000 == 0) {
                tmp = (target - 9000 * i) / 4000;
                if ((tmp >= 0) && (N - tmp - i) >= 0) {
                    num_10000 = i;
                    num_5000 = tmp;
                    num_1000 = N - num_10000 - num_5000;
                    break;
                }
            }
        } {
            if ((target - 9000 * i) % 4000 == 0) {
                tmp = (target - 9000 * i) / 4000;
                if ((tmp >= 0) && (N - tmp - i) >= 0) {
                    num_10000 = i;
                    num_5000 = tmp;
                    num_1000 = N - num_10000 - num_5000;
                    break;
                }
            }
        } if ((target - 9000 * i) % 4000 == 0) {
                tmp = (target - 9000 * i) / 4000;
                if ((tmp >= 0) && (N - tmp - i) >= 0) {
                    num_10000 = i;
                    num_5000 = tmp;
                    num_1000 = N - num_10000 - num_5000;
                    break;
                }
            } (target - 9000 * i) % 4000 == 0 (target - 9000 * i) % 4000 (target - 9000 * i) target 9000 * i 9000 i 4000 0 {
                tmp = (target - 9000 * i) / 4000;
                if ((tmp >= 0) && (N - tmp - i) >= 0) {
                    num_10000 = i;
                    num_5000 = tmp;
                    num_1000 = N - num_10000 - num_5000;
                    break;
                }
            } tmp = (target - 9000 * i) / 4000 tmp (target - 9000 * i) / 4000 (target - 9000 * i) target 9000 * i 9000 i 4000 if ((tmp >= 0) && (N - tmp - i) >= 0) {
                    num_10000 = i;
                    num_5000 = tmp;
                    num_1000 = N - num_10000 - num_5000;
                    break;
                } (tmp >= 0) && (N - tmp - i) >= 0 (tmp >= 0) tmp 0 (N - tmp - i) >= 0 (N - tmp - i) N - tmp - i N tmp i 0 {
                    num_10000 = i;
                    num_5000 = tmp;
                    num_1000 = N - num_10000 - num_5000;
                    break;
                } num_10000 = i num_10000 i num_5000 = tmp num_5000 tmp num_1000 = N - num_10000 - num_5000 num_1000 N - num_10000 - num_5000 N - num_10000 - num_5000 N num_10000 num_5000 break; System.out.println(num_10000 + " " + num_5000 + " " + num_1000) System.out.println System.out System System.out num_10000 + " " + num_5000 + " " + num_1000 " " num_5000 num_10000 + " " + num_5000 + " " + num_1000 num_10000 " " num_5000 " " num_1000 String... args args public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long Y = sc.nextLong();
        sc.close();

        long num_10000 = -1;
        long num_5000 = -1;
        long num_1000 = -1;

        long target = Y - 1000 * N;
        long tmp = -1;

        for (int i = 0; i <= N; i++) {
            if ((target - 9000 * i) % 4000 == 0) {
                tmp = (target - 9000 * i) / 4000;
                if ((tmp >= 0) && (N - tmp - i) >= 0) {
                    num_10000 = i;
                    num_5000 = tmp;
                    num_1000 = N - num_10000 - num_5000;
                    break;
                }
            }
        }

        System.out.println(num_10000 + " " + num_5000 + " " + num_1000);
    }
} public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long Y = sc.nextLong();
        sc.close();

        long num_10000 = -1;
        long num_5000 = -1;
        long num_1000 = -1;

        long target = Y - 1000 * N;
        long tmp = -1;

        for (int i = 0; i <= N; i++) {
            if ((target - 9000 * i) % 4000 == 0) {
                tmp = (target - 9000 * i) / 4000;
                if ((tmp >= 0) && (N - tmp - i) >= 0) {
                    num_10000 = i;
                    num_5000 = tmp;
                    num_1000 = N - num_10000 - num_5000;
                    break;
                }
            }
        }

        System.out.println(num_10000 + " " + num_5000 + " " + num_1000);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long Y = sc.nextLong();
        sc.close();

        long num_10000 = -1;
        long num_5000 = -1;
        long num_1000 = -1;

        long target = Y - 1000 * N;
        long tmp = -1;

        for (int i = 0; i <= N; i++) {
            if ((target - 9000 * i) % 4000 == 0) {
                tmp = (target - 9000 * i) / 4000;
                if ((tmp >= 0) && (N - tmp - i) >= 0) {
                    num_10000 = i;
                    num_5000 = tmp;
                    num_1000 = N - num_10000 - num_5000;
                    break;
                }
            }
        }

        System.out.println(num_10000 + " " + num_5000 + " " + num_1000);
    }
}