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 _10000 = -1;
        int _5000 = -1;
        int _1000 = -1;

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N-i; j++) {
                for (int k = 0; k <= N-i-j; k++) {
                    if (i + j + k == N && 10000 * i + 5000 * j + 1000 * k == Y) {
                        _10000 = i;
                        _5000 = j;
                        _1000 = k;
                        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
                        sc.close();
                        return;
                    }
                }
            }
        }

        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
        sc.close();
    }
} 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 _10000 = -1;
        int _5000 = -1;
        int _1000 = -1;

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N-i; j++) {
                for (int k = 0; k <= N-i-j; k++) {
                    if (i + j + k == N && 10000 * i + 5000 * j + 1000 * k == Y) {
                        _10000 = i;
                        _5000 = j;
                        _1000 = k;
                        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
                        sc.close();
                        return;
                    }
                }
            }
        }

        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();

        int _10000 = -1;
        int _5000 = -1;
        int _1000 = -1;

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N-i; j++) {
                for (int k = 0; k <= N-i-j; k++) {
                    if (i + j + k == N && 10000 * i + 5000 * j + 1000 * k == Y) {
                        _10000 = i;
                        _5000 = j;
                        _1000 = k;
                        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
                        sc.close();
                        return;
                    }
                }
            }
        }

        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();

        int _10000 = -1;
        int _5000 = -1;
        int _1000 = -1;

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N-i; j++) {
                for (int k = 0; k <= N-i-j; k++) {
                    if (i + j + k == N && 10000 * i + 5000 * j + 1000 * k == Y) {
                        _10000 = i;
                        _5000 = j;
                        _1000 = k;
                        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
                        sc.close();
                        return;
                    }
                }
            }
        }

        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
        sc.close();
    } 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 _10000 = -1; _10000 -1 1 int _5000 = -1; _5000 -1 1 int _1000 = -1; _1000 -1 1 for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N-i; j++) {
                for (int k = 0; k <= N-i-j; k++) {
                    if (i + j + k == N && 10000 * i + 5000 * j + 1000 * k == Y) {
                        _10000 = i;
                        _5000 = j;
                        _1000 = k;
                        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
                        sc.close();
                        return;
                    }
                }
            }
        } int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
            for (int j = 0; j <= N-i; j++) {
                for (int k = 0; k <= N-i-j; k++) {
                    if (i + j + k == N && 10000 * i + 5000 * j + 1000 * k == Y) {
                        _10000 = i;
                        _5000 = j;
                        _1000 = k;
                        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
                        sc.close();
                        return;
                    }
                }
            }
        } {
            for (int j = 0; j <= N-i; j++) {
                for (int k = 0; k <= N-i-j; k++) {
                    if (i + j + k == N && 10000 * i + 5000 * j + 1000 * k == Y) {
                        _10000 = i;
                        _5000 = j;
                        _1000 = k;
                        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
                        sc.close();
                        return;
                    }
                }
            }
        } for (int j = 0; j <= N-i; j++) {
                for (int k = 0; k <= N-i-j; k++) {
                    if (i + j + k == N && 10000 * i + 5000 * j + 1000 * k == Y) {
                        _10000 = i;
                        _5000 = j;
                        _1000 = k;
                        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
                        sc.close();
                        return;
                    }
                }
            } int j = 0; int j = 0; j 0 j <= N-i j N-i N i j++ j++ j {
                for (int k = 0; k <= N-i-j; k++) {
                    if (i + j + k == N && 10000 * i + 5000 * j + 1000 * k == Y) {
                        _10000 = i;
                        _5000 = j;
                        _1000 = k;
                        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
                        sc.close();
                        return;
                    }
                }
            } {
                for (int k = 0; k <= N-i-j; k++) {
                    if (i + j + k == N && 10000 * i + 5000 * j + 1000 * k == Y) {
                        _10000 = i;
                        _5000 = j;
                        _1000 = k;
                        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
                        sc.close();
                        return;
                    }
                }
            } for (int k = 0; k <= N-i-j; k++) {
                    if (i + j + k == N && 10000 * i + 5000 * j + 1000 * k == Y) {
                        _10000 = i;
                        _5000 = j;
                        _1000 = k;
                        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
                        sc.close();
                        return;
                    }
                } int k = 0; int k = 0; k 0 k <= N-i-j k N-i-j N-i-j N i j k++ k++ k {
                    if (i + j + k == N && 10000 * i + 5000 * j + 1000 * k == Y) {
                        _10000 = i;
                        _5000 = j;
                        _1000 = k;
                        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
                        sc.close();
                        return;
                    }
                } {
                    if (i + j + k == N && 10000 * i + 5000 * j + 1000 * k == Y) {
                        _10000 = i;
                        _5000 = j;
                        _1000 = k;
                        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
                        sc.close();
                        return;
                    }
                } if (i + j + k == N && 10000 * i + 5000 * j + 1000 * k == Y) {
                        _10000 = i;
                        _5000 = j;
                        _1000 = k;
                        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
                        sc.close();
                        return;
                    } i + j + k == N && 10000 * i + 5000 * j + 1000 * k == Y i + j + k == N i + j + k i + j + k i j k N 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 {
                        _10000 = i;
                        _5000 = j;
                        _1000 = k;
                        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
                        sc.close();
                        return;
                    } _10000 = i _10000 i _5000 = j _5000 j _1000 = k _1000 k System.out.printf("%d %d %d\n", _10000, _5000, _1000) System.out.printf System.out System System.out "%d %d %d\n" _10000 _5000 _1000 sc.close() sc.close sc return; System.out.printf("%d %d %d\n", _10000, _5000, _1000) System.out.printf System.out System System.out "%d %d %d\n" _10000 _5000 _1000 sc.close() sc.close sc 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 _10000 = -1;
        int _5000 = -1;
        int _1000 = -1;

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N-i; j++) {
                for (int k = 0; k <= N-i-j; k++) {
                    if (i + j + k == N && 10000 * i + 5000 * j + 1000 * k == Y) {
                        _10000 = i;
                        _5000 = j;
                        _1000 = k;
                        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
                        sc.close();
                        return;
                    }
                }
            }
        }

        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
        sc.close();
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();

        int _10000 = -1;
        int _5000 = -1;
        int _1000 = -1;

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N-i; j++) {
                for (int k = 0; k <= N-i-j; k++) {
                    if (i + j + k == N && 10000 * i + 5000 * j + 1000 * k == Y) {
                        _10000 = i;
                        _5000 = j;
                        _1000 = k;
                        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
                        sc.close();
                        return;
                    }
                }
            }
        }

        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
        sc.close();
    }
} 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 _10000 = -1;
        int _5000 = -1;
        int _1000 = -1;

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N-i; j++) {
                for (int k = 0; k <= N-i-j; k++) {
                    if (i + j + k == N && 10000 * i + 5000 * j + 1000 * k == Y) {
                        _10000 = i;
                        _5000 = j;
                        _1000 = k;
                        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
                        sc.close();
                        return;
                    }
                }
            }
        }

        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
        sc.close();
    }
}