import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        long Y = Long.parseLong(sc.next());

        for (int i = 0; i <= N; i++) {
            for (int j = 0; (i+j) <= N; j++) {
                for (int k = 0; i+j+k <= N; k++) {
                    if ((i+j+k == N) && 1000*i + 5000*j + 10000*k == Y) {
                        System.out.println(k + " " + j + " " + i);
                        System.exit(0);
                    }
                }
            }
        }

        System.out.println("-1 -1 -1");
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        long Y = Long.parseLong(sc.next());

        for (int i = 0; i <= N; i++) {
            for (int j = 0; (i+j) <= N; j++) {
                for (int k = 0; i+j+k <= N; k++) {
                    if ((i+j+k == N) && 1000*i + 5000*j + 10000*k == Y) {
                        System.out.println(k + " " + j + " " + i);
                        System.exit(0);
                    }
                }
            }
        }

        System.out.println("-1 -1 -1");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        long Y = Long.parseLong(sc.next());

        for (int i = 0; i <= N; i++) {
            for (int j = 0; (i+j) <= N; j++) {
                for (int k = 0; i+j+k <= N; k++) {
                    if ((i+j+k == N) && 1000*i + 5000*j + 10000*k == Y) {
                        System.out.println(k + " " + j + " " + i);
                        System.exit(0);
                    }
                }
            }
        }

        System.out.println("-1 -1 -1");
    } main {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        long Y = Long.parseLong(sc.next());

        for (int i = 0; i <= N; i++) {
            for (int j = 0; (i+j) <= N; j++) {
                for (int k = 0; i+j+k <= N; k++) {
                    if ((i+j+k == N) && 1000*i + 5000*j + 10000*k == Y) {
                        System.out.println(k + " " + j + " " + i);
                        System.exit(0);
                    }
                }
            }
        }

        System.out.println("-1 -1 -1");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc long Y = Long.parseLong(sc.next()); Y Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc for (int i = 0; i <= N; i++) {
            for (int j = 0; (i+j) <= N; j++) {
                for (int k = 0; i+j+k <= N; k++) {
                    if ((i+j+k == N) && 1000*i + 5000*j + 10000*k == Y) {
                        System.out.println(k + " " + j + " " + i);
                        System.exit(0);
                    }
                }
            }
        } int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
            for (int j = 0; (i+j) <= N; j++) {
                for (int k = 0; i+j+k <= N; k++) {
                    if ((i+j+k == N) && 1000*i + 5000*j + 10000*k == Y) {
                        System.out.println(k + " " + j + " " + i);
                        System.exit(0);
                    }
                }
            }
        } {
            for (int j = 0; (i+j) <= N; j++) {
                for (int k = 0; i+j+k <= N; k++) {
                    if ((i+j+k == N) && 1000*i + 5000*j + 10000*k == Y) {
                        System.out.println(k + " " + j + " " + i);
                        System.exit(0);
                    }
                }
            }
        } for (int j = 0; (i+j) <= N; j++) {
                for (int k = 0; i+j+k <= N; k++) {
                    if ((i+j+k == N) && 1000*i + 5000*j + 10000*k == Y) {
                        System.out.println(k + " " + j + " " + i);
                        System.exit(0);
                    }
                }
            } int j = 0; int j = 0; j 0 (i+j) <= N (i+j) i j N j++ j++ j {
                for (int k = 0; i+j+k <= N; k++) {
                    if ((i+j+k == N) && 1000*i + 5000*j + 10000*k == Y) {
                        System.out.println(k + " " + j + " " + i);
                        System.exit(0);
                    }
                }
            } {
                for (int k = 0; i+j+k <= N; k++) {
                    if ((i+j+k == N) && 1000*i + 5000*j + 10000*k == Y) {
                        System.out.println(k + " " + j + " " + i);
                        System.exit(0);
                    }
                }
            } for (int k = 0; i+j+k <= N; k++) {
                    if ((i+j+k == N) && 1000*i + 5000*j + 10000*k == Y) {
                        System.out.println(k + " " + j + " " + i);
                        System.exit(0);
                    }
                } int k = 0; int k = 0; k 0 i+j+k <= N i+j+k i+j+k i j k N k++ k++ k {
                    if ((i+j+k == N) && 1000*i + 5000*j + 10000*k == Y) {
                        System.out.println(k + " " + j + " " + i);
                        System.exit(0);
                    }
                } {
                    if ((i+j+k == N) && 1000*i + 5000*j + 10000*k == Y) {
                        System.out.println(k + " " + j + " " + i);
                        System.exit(0);
                    }
                } if ((i+j+k == N) && 1000*i + 5000*j + 10000*k == Y) {
                        System.out.println(k + " " + j + " " + i);
                        System.exit(0);
                    } (i+j+k == N) && 1000*i + 5000*j + 10000*k == Y (i+j+k == N) i+j+k i+j+k i j k N 1000*i + 5000*j + 10000*k == Y 1000*i + 5000*j + 10000*k 1000*i + 5000*j + 10000*k 1000*i 1000 i 5000*j 5000 j 10000*k 10000 k Y {
                        System.out.println(k + " " + j + " " + i);
                        System.exit(0);
                    } System.out.println(k + " " + j + " " + i) System.out.println System.out System System.out k + " " + j + " " + i " " j k + " " + j + " " + i k " " j " " i System.exit(0) System.exit System 0 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 sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        long Y = Long.parseLong(sc.next());

        for (int i = 0; i <= N; i++) {
            for (int j = 0; (i+j) <= N; j++) {
                for (int k = 0; i+j+k <= N; k++) {
                    if ((i+j+k == N) && 1000*i + 5000*j + 10000*k == Y) {
                        System.out.println(k + " " + j + " " + i);
                        System.exit(0);
                    }
                }
            }
        }

        System.out.println("-1 -1 -1");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        long Y = Long.parseLong(sc.next());

        for (int i = 0; i <= N; i++) {
            for (int j = 0; (i+j) <= N; j++) {
                for (int k = 0; i+j+k <= N; k++) {
                    if ((i+j+k == N) && 1000*i + 5000*j + 10000*k == Y) {
                        System.out.println(k + " " + j + " " + i);
                        System.exit(0);
                    }
                }
            }
        }

        System.out.println("-1 -1 -1");
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        long Y = Long.parseLong(sc.next());

        for (int i = 0; i <= N; i++) {
            for (int j = 0; (i+j) <= N; j++) {
                for (int k = 0; i+j+k <= N; k++) {
                    if ((i+j+k == N) && 1000*i + 5000*j + 10000*k == Y) {
                        System.out.println(k + " " + j + " " + i);
                        System.exit(0);
                    }
                }
            }
        }

        System.out.println("-1 -1 -1");
    }
}
