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);
        ABC085_C solver = new ABC085_C();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC085_C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int y = in.nextInt();

            int ichi = 0;
            int gosen = 0;
            int sen = 0;

            boolean flag = false;

            for (int i = 0; i <= n; ++i) {
                for (int j = 0; j <= n; ++j) {
                    int sum = 10000 * i + 5000 * j + 1000 * (n - i - j);
                    if (sum == y && (n - i - j) >= 0) {
                        ichi = i;
                        gosen = j;
                        sen = n - i - j;
                        flag = true;
                        break;
                    } else flag = false;
                }
                if (flag) break;
                else continue;
            }

            if (flag) {
                out.printf("%d", ichi);
                out.printf(" ");
                out.printf("%d", gosen);
                out.printf(" ");
                out.printf("%d", sen);
            } else out.println("-1 -1 -1 ");
        }

    }
}
 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);
        ABC085_C solver = new ABC085_C();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC085_C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int y = in.nextInt();

            int ichi = 0;
            int gosen = 0;
            int sen = 0;

            boolean flag = false;

            for (int i = 0; i <= n; ++i) {
                for (int j = 0; j <= n; ++j) {
                    int sum = 10000 * i + 5000 * j + 1000 * (n - i - j);
                    if (sum == y && (n - i - j) >= 0) {
                        ichi = i;
                        gosen = j;
                        sen = n - i - j;
                        flag = true;
                        break;
                    } else flag = false;
                }
                if (flag) break;
                else continue;
            }

            if (flag) {
                out.printf("%d", ichi);
                out.printf(" ");
                out.printf("%d", gosen);
                out.printf(" ");
                out.printf("%d", sen);
            } else out.println("-1 -1 -1 ");
        }

    }
} 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);
        ABC085_C solver = new ABC085_C();
        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);
        ABC085_C solver = new ABC085_C();
        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) ABC085_C solver = new ABC085_C(); solver new ABC085_C() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class ABC085_C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int y = in.nextInt();

            int ichi = 0;
            int gosen = 0;
            int sen = 0;

            boolean flag = false;

            for (int i = 0; i <= n; ++i) {
                for (int j = 0; j <= n; ++j) {
                    int sum = 10000 * i + 5000 * j + 1000 * (n - i - j);
                    if (sum == y && (n - i - j) >= 0) {
                        ichi = i;
                        gosen = j;
                        sen = n - i - j;
                        flag = true;
                        break;
                    } else flag = false;
                }
                if (flag) break;
                else continue;
            }

            if (flag) {
                out.printf("%d", ichi);
                out.printf(" ");
                out.printf("%d", gosen);
                out.printf(" ");
                out.printf("%d", sen);
            } else out.println("-1 -1 -1 ");
        }

    } ABC085_C public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int y = in.nextInt();

            int ichi = 0;
            int gosen = 0;
            int sen = 0;

            boolean flag = false;

            for (int i = 0; i <= n; ++i) {
                for (int j = 0; j <= n; ++j) {
                    int sum = 10000 * i + 5000 * j + 1000 * (n - i - j);
                    if (sum == y && (n - i - j) >= 0) {
                        ichi = i;
                        gosen = j;
                        sen = n - i - j;
                        flag = true;
                        break;
                    } else flag = false;
                }
                if (flag) break;
                else continue;
            }

            if (flag) {
                out.printf("%d", ichi);
                out.printf(" ");
                out.printf("%d", gosen);
                out.printf(" ");
                out.printf("%d", sen);
            } else out.println("-1 -1 -1 ");
        } solve {
            int n = in.nextInt();
            int y = in.nextInt();

            int ichi = 0;
            int gosen = 0;
            int sen = 0;

            boolean flag = false;

            for (int i = 0; i <= n; ++i) {
                for (int j = 0; j <= n; ++j) {
                    int sum = 10000 * i + 5000 * j + 1000 * (n - i - j);
                    if (sum == y && (n - i - j) >= 0) {
                        ichi = i;
                        gosen = j;
                        sen = n - i - j;
                        flag = true;
                        break;
                    } else flag = false;
                }
                if (flag) break;
                else continue;
            }

            if (flag) {
                out.printf("%d", ichi);
                out.printf(" ");
                out.printf("%d", gosen);
                out.printf(" ");
                out.printf("%d", sen);
            } else out.println("-1 -1 -1 ");
        } int n = in.nextInt(); n in.nextInt() in.nextInt in int y = in.nextInt(); y in.nextInt() in.nextInt in int ichi = 0; ichi 0 int gosen = 0; gosen 0 int sen = 0; sen 0 boolean flag = false; flag false for (int i = 0; i <= n; ++i) {
                for (int j = 0; j <= n; ++j) {
                    int sum = 10000 * i + 5000 * j + 1000 * (n - i - j);
                    if (sum == y && (n - i - j) >= 0) {
                        ichi = i;
                        gosen = j;
                        sen = n - i - j;
                        flag = true;
                        break;
                    } else flag = false;
                }
                if (flag) break;
                else continue;
            } int i = 0; int i = 0; i 0 i <= n i n ++i ++i i {
                for (int j = 0; j <= n; ++j) {
                    int sum = 10000 * i + 5000 * j + 1000 * (n - i - j);
                    if (sum == y && (n - i - j) >= 0) {
                        ichi = i;
                        gosen = j;
                        sen = n - i - j;
                        flag = true;
                        break;
                    } else flag = false;
                }
                if (flag) break;
                else continue;
            } {
                for (int j = 0; j <= n; ++j) {
                    int sum = 10000 * i + 5000 * j + 1000 * (n - i - j);
                    if (sum == y && (n - i - j) >= 0) {
                        ichi = i;
                        gosen = j;
                        sen = n - i - j;
                        flag = true;
                        break;
                    } else flag = false;
                }
                if (flag) break;
                else continue;
            } for (int j = 0; j <= n; ++j) {
                    int sum = 10000 * i + 5000 * j + 1000 * (n - i - j);
                    if (sum == y && (n - i - j) >= 0) {
                        ichi = i;
                        gosen = j;
                        sen = n - i - j;
                        flag = true;
                        break;
                    } else flag = false;
                } int j = 0; int j = 0; j 0 j <= n j n ++j ++j j {
                    int sum = 10000 * i + 5000 * j + 1000 * (n - i - j);
                    if (sum == y && (n - i - j) >= 0) {
                        ichi = i;
                        gosen = j;
                        sen = n - i - j;
                        flag = true;
                        break;
                    } else flag = false;
                } {
                    int sum = 10000 * i + 5000 * j + 1000 * (n - i - j);
                    if (sum == y && (n - i - j) >= 0) {
                        ichi = i;
                        gosen = j;
                        sen = n - i - j;
                        flag = true;
                        break;
                    } else flag = false;
                } int sum = 10000 * i + 5000 * j + 1000 * (n - i - j); sum 10000 * i + 5000 * j + 1000 * (n - i - j) 10000 * i + 5000 * j + 1000 * (n - i - j) 10000 * i 10000 i 5000 * j 5000 j 1000 * (n - i - j) 1000 (n - i - j) n - i - j n i j if (sum == y && (n - i - j) >= 0) {
                        ichi = i;
                        gosen = j;
                        sen = n - i - j;
                        flag = true;
                        break;
                    } else flag = false; sum == y && (n - i - j) >= 0 sum == y sum y (n - i - j) >= 0 (n - i - j) n - i - j n i j 0 {
                        ichi = i;
                        gosen = j;
                        sen = n - i - j;
                        flag = true;
                        break;
                    } ichi = i ichi i gosen = j gosen j sen = n - i - j sen n - i - j n - i - j n i j flag = true flag true break; flag = false flag false if (flag) break;
                else continue; flag break; continue; if (flag) {
                out.printf("%d", ichi);
                out.printf(" ");
                out.printf("%d", gosen);
                out.printf(" ");
                out.printf("%d", sen);
            } else out.println("-1 -1 -1 "); flag {
                out.printf("%d", ichi);
                out.printf(" ");
                out.printf("%d", gosen);
                out.printf(" ");
                out.printf("%d", sen);
            } out.printf("%d", ichi) out.printf out "%d" ichi out.printf(" ") out.printf out " " out.printf("%d", gosen) out.printf out "%d" gosen out.printf(" ") out.printf out " " out.printf("%d", sen) out.printf out "%d" sen out.println("-1 -1 -1 ") out.println out "-1 -1 -1 " 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);
        ABC085_C solver = new ABC085_C();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC085_C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int y = in.nextInt();

            int ichi = 0;
            int gosen = 0;
            int sen = 0;

            boolean flag = false;

            for (int i = 0; i <= n; ++i) {
                for (int j = 0; j <= n; ++j) {
                    int sum = 10000 * i + 5000 * j + 1000 * (n - i - j);
                    if (sum == y && (n - i - j) >= 0) {
                        ichi = i;
                        gosen = j;
                        sen = n - i - j;
                        flag = true;
                        break;
                    } else flag = false;
                }
                if (flag) break;
                else continue;
            }

            if (flag) {
                out.printf("%d", ichi);
                out.printf(" ");
                out.printf("%d", gosen);
                out.printf(" ");
                out.printf("%d", sen);
            } else out.println("-1 -1 -1 ");
        }

    }
} 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);
        ABC085_C solver = new ABC085_C();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC085_C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int y = in.nextInt();

            int ichi = 0;
            int gosen = 0;
            int sen = 0;

            boolean flag = false;

            for (int i = 0; i <= n; ++i) {
                for (int j = 0; j <= n; ++j) {
                    int sum = 10000 * i + 5000 * j + 1000 * (n - i - j);
                    if (sum == y && (n - i - j) >= 0) {
                        ichi = i;
                        gosen = j;
                        sen = n - i - j;
                        flag = true;
                        break;
                    } else flag = false;
                }
                if (flag) break;
                else continue;
            }

            if (flag) {
                out.printf("%d", ichi);
                out.printf(" ");
                out.printf("%d", gosen);
                out.printf(" ");
                out.printf("%d", sen);
            } else out.println("-1 -1 -1 ");
        }

    }
} 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);
        ABC085_C solver = new ABC085_C();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC085_C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int y = in.nextInt();

            int ichi = 0;
            int gosen = 0;
            int sen = 0;

            boolean flag = false;

            for (int i = 0; i <= n; ++i) {
                for (int j = 0; j <= n; ++j) {
                    int sum = 10000 * i + 5000 * j + 1000 * (n - i - j);
                    if (sum == y && (n - i - j) >= 0) {
                        ichi = i;
                        gosen = j;
                        sen = n - i - j;
                        flag = true;
                        break;
                    } else flag = false;
                }
                if (flag) break;
                else continue;
            }

            if (flag) {
                out.printf("%d", ichi);
                out.printf(" ");
                out.printf("%d", gosen);
                out.printf(" ");
                out.printf("%d", sen);
            } else out.println("-1 -1 -1 ");
        }

    }
}

