#if __INCLUDE_LEVEL__ == 0 #include __BASE_FILE__ namespace { void solve() { Int n, m; scan(n, m); Vec a(n); scan(a); ranges::sort(a); for (Int& e : a) { e /= 100; } Vec c(100); c[0] = inf(); while (m--) { Int b; scan(b); ++c[b]; } Vec ans(n + 1); for (const Int i : rep(n)) { Int L = i + 1; for (const Int r : rev(rep(100))) { const Int R = std::min(L + c[r], n + 1); ans[L] += a[i] * (100 - r); if (R <= n) { ans[R] -= a[i] * (100 - r); } else { break; } L = R; } } for (const Int k : rep1(n)) { ans[k] += ans[k - 1]; print(ans[k]); } } } // namespace int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); std::cout << std::setprecision(std::numeric_limits::max_digits10); solve(); } #else // __INCLUDE_LEVEL__ #include using i8 = int8_t; using i16 = int16_t; using i32 = int32_t; using i64 = int64_t; using i128 = __int128_t; using u8 = uint8_t; using u16 = uint16_t; using u32 = uint32_t; using u64 = uint64_t; using u128 = __uint128_t; using Int = int64_t; using Float = double; using Str = std::string; template using Pair = std::pair; template using Tuple = std::tuple; template using Arr = std::array; template using Vec = std::vector; template using Set = std::set; template using Multiset = std::multiset; template using Map = std::map; template using MinHeap = std::priority_queue, std::greater>; template using MaxHeap = std::priority_queue; namespace ranges = std::ranges; namespace views = std::views; inline constexpr auto len = ranges::ssize; inline constexpr auto rev = views::reverse; constexpr auto rep(Int l, Int r) { return views::iota(std::min(l, r), r); } constexpr auto rep(Int n) { return rep(0, n); } constexpr auto rep1(Int l, Int r) { return rep(l, r + 1); } constexpr auto rep1(Int n) { return rep(1, n + 1); } template bool chmin(T& x, U&& y) { return y < x && (x = std::forward(y), true); } template bool chmax(T& x, U&& y) { return x < y && (x = std::forward(y), true); } template T inf() { T ret; std::memset(&ret, 0x3f, sizeof(ret)); return ret; } template T inf() { return std::numeric_limits::infinity(); } template concept Range = ranges::range && !std::convertible_to; template concept TupleLike = std::__is_tuple_like::value && !Range; namespace std { istream& operator>>(istream& is, Range auto&& r) { for (auto&& e : r) { is >> e; } return is; } istream& operator>>(istream& is, TupleLike auto&& t) { return apply([&](auto&... xs) -> istream& { return (is >> ... >> xs); }, t); } ostream& operator<<(ostream& os, Range auto&& r) { for (string_view sep = ""; auto&& e : r) { os << exchange(sep, " ") << e; } return os; } ostream& operator<<(ostream& os, TupleLike auto&& t) { const auto f = [&](auto&... xs) -> ostream& { [[maybe_unused]] string_view sep = ""; ((os << exchange(sep, " ") << xs), ...); return os; }; return apply(f, t); } } // namespace std #define DEF_INC_OR_DEC(op) \ auto& operator op(Range auto&& r) { \ for (auto&& e : r) { \ op e; \ } \ return r; \ } \ auto& operator op(TupleLike auto&& t) { \ std::apply([](auto&... xs) { (op xs, ...); }, t); \ return t; \ } DEF_INC_OR_DEC(++) DEF_INC_OR_DEC(--) #undef DEF_INC_OR_DEC void scan(auto&&... xs) { std::cin >> std::tie(xs...); } void print(auto&&... xs) { std::cout << std::tie(xs...) << '\n'; } template class fix { public: explicit fix(F f) : f_(std::move(f)) {} decltype(auto) operator()(auto&&... xs) const { return f_(std::ref(*this), std::forward(xs)...); } private: F f_; }; #endif // __INCLUDE_LEVEL__