
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long n = sc.nextLong();
        long m = sc.nextLong();


        for (long x = 0; x <= n; ++x) {
            long tmpx = x * 10000L;
            if (tmpx > m) {
                break;
            }
            for (long y = 0; y <= n - x; ++y) {
                long tmpy = tmpx + y * 5000L;
                if (tmpy > m) {
                    break;
                }
                for (long z = 0; z <= n - x - y; ++z) {
                    long tmpz = tmpy + z * 1000L;
                    if (tmpz > m) {
                        break;
                    }
                    if (tmpz == m && x + y + z == n) {
                        System.out.println(String.format("%d %d %d", x, y, z));
                        return;
                    }
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long n = sc.nextLong();
        long m = sc.nextLong();


        for (long x = 0; x <= n; ++x) {
            long tmpx = x * 10000L;
            if (tmpx > m) {
                break;
            }
            for (long y = 0; y <= n - x; ++y) {
                long tmpy = tmpx + y * 5000L;
                if (tmpy > m) {
                    break;
                }
                for (long z = 0; z <= n - x - y; ++z) {
                    long tmpz = tmpy + z * 1000L;
                    if (tmpz > m) {
                        break;
                    }
                    if (tmpz == m && x + y + z == n) {
                        System.out.println(String.format("%d %d %d", x, y, z));
                        return;
                    }
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long n = sc.nextLong();
        long m = sc.nextLong();


        for (long x = 0; x <= n; ++x) {
            long tmpx = x * 10000L;
            if (tmpx > m) {
                break;
            }
            for (long y = 0; y <= n - x; ++y) {
                long tmpy = tmpx + y * 5000L;
                if (tmpy > m) {
                    break;
                }
                for (long z = 0; z <= n - x - y; ++z) {
                    long tmpz = tmpy + z * 1000L;
                    if (tmpz > m) {
                        break;
                    }
                    if (tmpz == m && x + y + z == n) {
                        System.out.println(String.format("%d %d %d", x, y, z));
                        return;
                    }
                }
            }
        }
        System.out.println("-1 -1 -1");
    } main {
        Scanner sc = new Scanner(System.in);

        long n = sc.nextLong();
        long m = sc.nextLong();


        for (long x = 0; x <= n; ++x) {
            long tmpx = x * 10000L;
            if (tmpx > m) {
                break;
            }
            for (long y = 0; y <= n - x; ++y) {
                long tmpy = tmpx + y * 5000L;
                if (tmpy > m) {
                    break;
                }
                for (long z = 0; z <= n - x - y; ++z) {
                    long tmpz = tmpy + z * 1000L;
                    if (tmpz > m) {
                        break;
                    }
                    if (tmpz == m && x + y + z == n) {
                        System.out.println(String.format("%d %d %d", x, y, z));
                        return;
                    }
                }
            }
        }
        System.out.println("-1 -1 -1");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long n = sc.nextLong(); n sc.nextLong() sc.nextLong sc long m = sc.nextLong(); m sc.nextLong() sc.nextLong sc for (long x = 0; x <= n; ++x) {
            long tmpx = x * 10000L;
            if (tmpx > m) {
                break;
            }
            for (long y = 0; y <= n - x; ++y) {
                long tmpy = tmpx + y * 5000L;
                if (tmpy > m) {
                    break;
                }
                for (long z = 0; z <= n - x - y; ++z) {
                    long tmpz = tmpy + z * 1000L;
                    if (tmpz > m) {
                        break;
                    }
                    if (tmpz == m && x + y + z == n) {
                        System.out.println(String.format("%d %d %d", x, y, z));
                        return;
                    }
                }
            }
        } long x = 0; long x = 0; x 0 x <= n x n ++x ++x x {
            long tmpx = x * 10000L;
            if (tmpx > m) {
                break;
            }
            for (long y = 0; y <= n - x; ++y) {
                long tmpy = tmpx + y * 5000L;
                if (tmpy > m) {
                    break;
                }
                for (long z = 0; z <= n - x - y; ++z) {
                    long tmpz = tmpy + z * 1000L;
                    if (tmpz > m) {
                        break;
                    }
                    if (tmpz == m && x + y + z == n) {
                        System.out.println(String.format("%d %d %d", x, y, z));
                        return;
                    }
                }
            }
        } {
            long tmpx = x * 10000L;
            if (tmpx > m) {
                break;
            }
            for (long y = 0; y <= n - x; ++y) {
                long tmpy = tmpx + y * 5000L;
                if (tmpy > m) {
                    break;
                }
                for (long z = 0; z <= n - x - y; ++z) {
                    long tmpz = tmpy + z * 1000L;
                    if (tmpz > m) {
                        break;
                    }
                    if (tmpz == m && x + y + z == n) {
                        System.out.println(String.format("%d %d %d", x, y, z));
                        return;
                    }
                }
            }
        } long tmpx = x * 10000L; tmpx x * 10000L x 10000L if (tmpx > m) {
                break;
            } tmpx > m tmpx m {
                break;
            } break; for (long y = 0; y <= n - x; ++y) {
                long tmpy = tmpx + y * 5000L;
                if (tmpy > m) {
                    break;
                }
                for (long z = 0; z <= n - x - y; ++z) {
                    long tmpz = tmpy + z * 1000L;
                    if (tmpz > m) {
                        break;
                    }
                    if (tmpz == m && x + y + z == n) {
                        System.out.println(String.format("%d %d %d", x, y, z));
                        return;
                    }
                }
            } long y = 0; long y = 0; y 0 y <= n - x y n - x n x ++y ++y y {
                long tmpy = tmpx + y * 5000L;
                if (tmpy > m) {
                    break;
                }
                for (long z = 0; z <= n - x - y; ++z) {
                    long tmpz = tmpy + z * 1000L;
                    if (tmpz > m) {
                        break;
                    }
                    if (tmpz == m && x + y + z == n) {
                        System.out.println(String.format("%d %d %d", x, y, z));
                        return;
                    }
                }
            } {
                long tmpy = tmpx + y * 5000L;
                if (tmpy > m) {
                    break;
                }
                for (long z = 0; z <= n - x - y; ++z) {
                    long tmpz = tmpy + z * 1000L;
                    if (tmpz > m) {
                        break;
                    }
                    if (tmpz == m && x + y + z == n) {
                        System.out.println(String.format("%d %d %d", x, y, z));
                        return;
                    }
                }
            } long tmpy = tmpx + y * 5000L; tmpy tmpx + y * 5000L tmpx y * 5000L y 5000L if (tmpy > m) {
                    break;
                } tmpy > m tmpy m {
                    break;
                } break; for (long z = 0; z <= n - x - y; ++z) {
                    long tmpz = tmpy + z * 1000L;
                    if (tmpz > m) {
                        break;
                    }
                    if (tmpz == m && x + y + z == n) {
                        System.out.println(String.format("%d %d %d", x, y, z));
                        return;
                    }
                } long z = 0; long z = 0; z 0 z <= n - x - y z n - x - y n - x - y n x y ++z ++z z {
                    long tmpz = tmpy + z * 1000L;
                    if (tmpz > m) {
                        break;
                    }
                    if (tmpz == m && x + y + z == n) {
                        System.out.println(String.format("%d %d %d", x, y, z));
                        return;
                    }
                } {
                    long tmpz = tmpy + z * 1000L;
                    if (tmpz > m) {
                        break;
                    }
                    if (tmpz == m && x + y + z == n) {
                        System.out.println(String.format("%d %d %d", x, y, z));
                        return;
                    }
                } long tmpz = tmpy + z * 1000L; tmpz tmpy + z * 1000L tmpy z * 1000L z 1000L if (tmpz > m) {
                        break;
                    } tmpz > m tmpz m {
                        break;
                    } break; if (tmpz == m && x + y + z == n) {
                        System.out.println(String.format("%d %d %d", x, y, z));
                        return;
                    } tmpz == m && x + y + z == n tmpz == m tmpz m x + y + z == n x + y + z x + y + z x y z n {
                        System.out.println(String.format("%d %d %d", x, y, z));
                        return;
                    } System.out.println(String.format("%d %d %d", x, y, z)) System.out.println System.out System System.out String.format("%d %d %d", x, y, z) String.format String "%d %d %d" x y z return; 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);

        long n = sc.nextLong();
        long m = sc.nextLong();


        for (long x = 0; x <= n; ++x) {
            long tmpx = x * 10000L;
            if (tmpx > m) {
                break;
            }
            for (long y = 0; y <= n - x; ++y) {
                long tmpy = tmpx + y * 5000L;
                if (tmpy > m) {
                    break;
                }
                for (long z = 0; z <= n - x - y; ++z) {
                    long tmpz = tmpy + z * 1000L;
                    if (tmpz > m) {
                        break;
                    }
                    if (tmpz == m && x + y + z == n) {
                        System.out.println(String.format("%d %d %d", x, y, z));
                        return;
                    }
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long n = sc.nextLong();
        long m = sc.nextLong();


        for (long x = 0; x <= n; ++x) {
            long tmpx = x * 10000L;
            if (tmpx > m) {
                break;
            }
            for (long y = 0; y <= n - x; ++y) {
                long tmpy = tmpx + y * 5000L;
                if (tmpy > m) {
                    break;
                }
                for (long z = 0; z <= n - x - y; ++z) {
                    long tmpz = tmpy + z * 1000L;
                    if (tmpz > m) {
                        break;
                    }
                    if (tmpz == m && x + y + z == n) {
                        System.out.println(String.format("%d %d %d", x, y, z));
                        return;
                    }
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
} Main

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long n = sc.nextLong();
        long m = sc.nextLong();


        for (long x = 0; x <= n; ++x) {
            long tmpx = x * 10000L;
            if (tmpx > m) {
                break;
            }
            for (long y = 0; y <= n - x; ++y) {
                long tmpy = tmpx + y * 5000L;
                if (tmpy > m) {
                    break;
                }
                for (long z = 0; z <= n - x - y; ++z) {
                    long tmpz = tmpy + z * 1000L;
                    if (tmpz > m) {
                        break;
                    }
                    if (tmpz == m && x + y + z == n) {
                        System.out.println(String.format("%d %d %d", x, y, z));
                        return;
                    }
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
}
