import java.util.Scanner;

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

        int x = -1;// 10000円をx枚
        int y = -1;// 5000円をy枚
        int z = -1;// 1000円をz枚

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                int tmpX = i;
                int tmpY = j;
                int tmpZ = N - (i+j);
                if (tmpZ < 0) break;

                int tmpSum = (10000 * tmpX) + (5000 * tmpY) + (1000 * tmpZ);
                if (tmpSum == Y) {
                    x = tmpX;
                    y = tmpY;
                    z = tmpZ;

                    break;
                }
            }
        }

        System.out.println(x + " " + y + " " + z);
    }
} 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();// N枚
        int Y = sc.nextInt();// Y円

        int x = -1;// 10000円をx枚
        int y = -1;// 5000円をy枚
        int z = -1;// 1000円をz枚

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                int tmpX = i;
                int tmpY = j;
                int tmpZ = N - (i+j);
                if (tmpZ < 0) break;

                int tmpSum = (10000 * tmpX) + (5000 * tmpY) + (1000 * tmpZ);
                if (tmpSum == Y) {
                    x = tmpX;
                    y = tmpY;
                    z = tmpZ;

                    break;
                }
            }
        }

        System.out.println(x + " " + y + " " + z);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();// N枚
        int Y = sc.nextInt();// Y円

        int x = -1;// 10000円をx枚
        int y = -1;// 5000円をy枚
        int z = -1;// 1000円をz枚

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                int tmpX = i;
                int tmpY = j;
                int tmpZ = N - (i+j);
                if (tmpZ < 0) break;

                int tmpSum = (10000 * tmpX) + (5000 * tmpY) + (1000 * tmpZ);
                if (tmpSum == Y) {
                    x = tmpX;
                    y = tmpY;
                    z = tmpZ;

                    break;
                }
            }
        }

        System.out.println(x + " " + y + " " + z);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();// N枚
        int Y = sc.nextInt();// Y円

        int x = -1;// 10000円をx枚
        int y = -1;// 5000円をy枚
        int z = -1;// 1000円をz枚

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                int tmpX = i;
                int tmpY = j;
                int tmpZ = N - (i+j);
                if (tmpZ < 0) break;

                int tmpSum = (10000 * tmpX) + (5000 * tmpY) + (1000 * tmpZ);
                if (tmpSum == Y) {
                    x = tmpX;
                    y = tmpY;
                    z = tmpZ;

                    break;
                }
            }
        }

        System.out.println(x + " " + y + " " + z);
    } 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 x = -1; x -1 1 int y = -1; y -1 1 int z = -1; z -1 1 for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                int tmpX = i;
                int tmpY = j;
                int tmpZ = N - (i+j);
                if (tmpZ < 0) break;

                int tmpSum = (10000 * tmpX) + (5000 * tmpY) + (1000 * tmpZ);
                if (tmpSum == Y) {
                    x = tmpX;
                    y = tmpY;
                    z = tmpZ;

                    break;
                }
            }
        } int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
            for (int j = 0; j <= N; j++) {
                int tmpX = i;
                int tmpY = j;
                int tmpZ = N - (i+j);
                if (tmpZ < 0) break;

                int tmpSum = (10000 * tmpX) + (5000 * tmpY) + (1000 * tmpZ);
                if (tmpSum == Y) {
                    x = tmpX;
                    y = tmpY;
                    z = tmpZ;

                    break;
                }
            }
        } {
            for (int j = 0; j <= N; j++) {
                int tmpX = i;
                int tmpY = j;
                int tmpZ = N - (i+j);
                if (tmpZ < 0) break;

                int tmpSum = (10000 * tmpX) + (5000 * tmpY) + (1000 * tmpZ);
                if (tmpSum == Y) {
                    x = tmpX;
                    y = tmpY;
                    z = tmpZ;

                    break;
                }
            }
        } for (int j = 0; j <= N; j++) {
                int tmpX = i;
                int tmpY = j;
                int tmpZ = N - (i+j);
                if (tmpZ < 0) break;

                int tmpSum = (10000 * tmpX) + (5000 * tmpY) + (1000 * tmpZ);
                if (tmpSum == Y) {
                    x = tmpX;
                    y = tmpY;
                    z = tmpZ;

                    break;
                }
            } int j = 0; int j = 0; j 0 j <= N j N j++ j++ j {
                int tmpX = i;
                int tmpY = j;
                int tmpZ = N - (i+j);
                if (tmpZ < 0) break;

                int tmpSum = (10000 * tmpX) + (5000 * tmpY) + (1000 * tmpZ);
                if (tmpSum == Y) {
                    x = tmpX;
                    y = tmpY;
                    z = tmpZ;

                    break;
                }
            } {
                int tmpX = i;
                int tmpY = j;
                int tmpZ = N - (i+j);
                if (tmpZ < 0) break;

                int tmpSum = (10000 * tmpX) + (5000 * tmpY) + (1000 * tmpZ);
                if (tmpSum == Y) {
                    x = tmpX;
                    y = tmpY;
                    z = tmpZ;

                    break;
                }
            } int tmpX = i; tmpX i int tmpY = j; tmpY j int tmpZ = N - (i+j); tmpZ N - (i+j) N (i+j) i j if (tmpZ < 0) break; tmpZ < 0 tmpZ 0 break; int tmpSum = (10000 * tmpX) + (5000 * tmpY) + (1000 * tmpZ); tmpSum (10000 * tmpX) + (5000 * tmpY) + (1000 * tmpZ) (10000 * tmpX) + (5000 * tmpY) + (1000 * tmpZ) (10000 * tmpX) 10000 tmpX (5000 * tmpY) 5000 tmpY (1000 * tmpZ) 1000 tmpZ if (tmpSum == Y) {
                    x = tmpX;
                    y = tmpY;
                    z = tmpZ;

                    break;
                } tmpSum == Y tmpSum Y {
                    x = tmpX;
                    y = tmpY;
                    z = tmpZ;

                    break;
                } x = tmpX x tmpX y = tmpY y tmpY z = tmpZ z tmpZ break; System.out.println(x + " " + y + " " + z) System.out.println System.out System System.out x + " " + y + " " + z " " y x + " " + y + " " + z x " " y " " z String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();// N枚
        int Y = sc.nextInt();// Y円

        int x = -1;// 10000円をx枚
        int y = -1;// 5000円をy枚
        int z = -1;// 1000円をz枚

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                int tmpX = i;
                int tmpY = j;
                int tmpZ = N - (i+j);
                if (tmpZ < 0) break;

                int tmpSum = (10000 * tmpX) + (5000 * tmpY) + (1000 * tmpZ);
                if (tmpSum == Y) {
                    x = tmpX;
                    y = tmpY;
                    z = tmpZ;

                    break;
                }
            }
        }

        System.out.println(x + " " + y + " " + z);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();// N枚
        int Y = sc.nextInt();// Y円

        int x = -1;// 10000円をx枚
        int y = -1;// 5000円をy枚
        int z = -1;// 1000円をz枚

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                int tmpX = i;
                int tmpY = j;
                int tmpZ = N - (i+j);
                if (tmpZ < 0) break;

                int tmpSum = (10000 * tmpX) + (5000 * tmpY) + (1000 * tmpZ);
                if (tmpSum == Y) {
                    x = tmpX;
                    y = tmpY;
                    z = tmpZ;

                    break;
                }
            }
        }

        System.out.println(x + " " + y + " " + z);
    }
} Main
import java.util.Scanner;

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

        int x = -1;// 10000円をx枚
        int y = -1;// 5000円をy枚
        int z = -1;// 1000円をz枚

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N; j++) {
                int tmpX = i;
                int tmpY = j;
                int tmpZ = N - (i+j);
                if (tmpZ < 0) break;

                int tmpSum = (10000 * tmpX) + (5000 * tmpY) + (1000 * tmpZ);
                if (tmpSum == Y) {
                    x = tmpX;
                    y = tmpY;
                    z = tmpZ;

                    break;
                }
            }
        }

        System.out.println(x + " " + y + " " + z);
    }
}
