import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        COtoshidama solver = new COtoshidama();
        solver.solve(1, in, out);
        out.close();
    }

    static class COtoshidama {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = Integer.parseInt(in.next());
            int sum = Integer.parseInt(in.next());
            int x = -1;
            int y = -1;
            int z = -1;

            out:
            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    if (10000 * i + 5000 * j + 1000 * (n - i - j) == sum) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        break out;
                    }
                }
            }
            out.println("" + x + " " + y + " " + z);
        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        COtoshidama solver = new COtoshidama();
        solver.solve(1, in, out);
        out.close();
    }

    static class COtoshidama {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = Integer.parseInt(in.next());
            int sum = Integer.parseInt(in.next());
            int x = -1;
            int y = -1;
            int z = -1;

            out:
            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    if (10000 * i + 5000 * j + 1000 * (n - i - j) == sum) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        break out;
                    }
                }
            }
            out.println("" + x + " " + y + " " + z);
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        COtoshidama solver = new COtoshidama();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        COtoshidama solver = new COtoshidama();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) COtoshidama solver = new COtoshidama(); solver new COtoshidama() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class COtoshidama {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = Integer.parseInt(in.next());
            int sum = Integer.parseInt(in.next());
            int x = -1;
            int y = -1;
            int z = -1;

            out:
            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    if (10000 * i + 5000 * j + 1000 * (n - i - j) == sum) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        break out;
                    }
                }
            }
            out.println("" + x + " " + y + " " + z);
        }

    } COtoshidama public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = Integer.parseInt(in.next());
            int sum = Integer.parseInt(in.next());
            int x = -1;
            int y = -1;
            int z = -1;

            out:
            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    if (10000 * i + 5000 * j + 1000 * (n - i - j) == sum) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        break out;
                    }
                }
            }
            out.println("" + x + " " + y + " " + z);
        } solve {
            int n = Integer.parseInt(in.next());
            int sum = Integer.parseInt(in.next());
            int x = -1;
            int y = -1;
            int z = -1;

            out:
            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    if (10000 * i + 5000 * j + 1000 * (n - i - j) == sum) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        break out;
                    }
                }
            }
            out.println("" + x + " " + y + " " + z);
        } int n = Integer.parseInt(in.next()); n Integer.parseInt(in.next()) Integer.parseInt Integer in.next() in.next in int sum = Integer.parseInt(in.next()); sum Integer.parseInt(in.next()) Integer.parseInt Integer in.next() in.next in int x = -1; x -1 1 int y = -1; y -1 1 int z = -1; z -1 1 out.println("" + x + " " + y + " " + z) out.println out "" + x + " " + y + " " + z " " y " " "" + x + " " + y + " " + z "" x " " y " " z int testNumber testNumber Scanner in in PrintWriter out out public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        COtoshidama solver = new COtoshidama();
        solver.solve(1, in, out);
        out.close();
    }

    static class COtoshidama {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = Integer.parseInt(in.next());
            int sum = Integer.parseInt(in.next());
            int x = -1;
            int y = -1;
            int z = -1;

            out:
            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    if (10000 * i + 5000 * j + 1000 * (n - i - j) == sum) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        break out;
                    }
                }
            }
            out.println("" + x + " " + y + " " + z);
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        COtoshidama solver = new COtoshidama();
        solver.solve(1, in, out);
        out.close();
    }

    static class COtoshidama {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = Integer.parseInt(in.next());
            int sum = Integer.parseInt(in.next());
            int x = -1;
            int y = -1;
            int z = -1;

            out:
            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    if (10000 * i + 5000 * j + 1000 * (n - i - j) == sum) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        break out;
                    }
                }
            }
            out.println("" + x + " " + y + " " + z);
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        COtoshidama solver = new COtoshidama();
        solver.solve(1, in, out);
        out.close();
    }

    static class COtoshidama {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = Integer.parseInt(in.next());
            int sum = Integer.parseInt(in.next());
            int x = -1;
            int y = -1;
            int z = -1;

            out:
            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    if (10000 * i + 5000 * j + 1000 * (n - i - j) == sum) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        break out;
                    }
                }
            }
            out.println("" + x + " " + y + " " + z);
        }

    }
}

