import java.util.Arrays;
import java.util.Scanner;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

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

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }

} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

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

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }

} Main void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int k = n - j - i;
                if (10000 * i + 5000 * j + 1000 * k == y) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    } run {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int k = n - j - i;
                if (10000 * i + 5000 * j + 1000 * k == y) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    } 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 for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int k = n - j - i;
                if (10000 * i + 5000 * j + 1000 * k == y) {
                    System.out.println(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 - i; j++) {
                int k = n - j - i;
                if (10000 * i + 5000 * j + 1000 * k == y) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        } {
            for (int j = 0; j <= n - i; j++) {
                int k = n - j - i;
                if (10000 * i + 5000 * j + 1000 * k == y) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        } for (int j = 0; j <= n - i; j++) {
                int k = n - j - i;
                if (10000 * i + 5000 * j + 1000 * k == y) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            } int j = 0; int j = 0; j 0 j <= n - i j n - i n i j++ j++ j {
                int k = n - j - i;
                if (10000 * i + 5000 * j + 1000 * k == y) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            } {
                int k = n - j - i;
                if (10000 * i + 5000 * j + 1000 * k == y) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            } int k = n - j - i; k n - j - i n - j - i n j i if (10000 * i + 5000 * j + 1000 * k == y) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                } 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 {
                    System.out.println(i + " " + j + " " + k);
                    return;
                } System.out.println(i + " " + j + " " + k) System.out.println System.out System System.out i + " " + j + " " + k " " j i + " " + j + " " + k i " " j " " k return; System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    } debug {
        System.err.println(Arrays.deepToString(os));
    } System.err.println(Arrays.deepToString(os)) System.err.println System.err System System.err Arrays.deepToString(os) Arrays.deepToString Arrays os Object... os os public static void main(String[] args) {
        new Main().run();
    } main {
        new Main().run();
    } new Main().run() new Main().run new Main() String[] args args public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

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

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }

} public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

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

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }

} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

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

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }

}
