#include <iostream>
#include <vector>
#include <algorithm>

#define int long long

using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i].first;
        a[i].second = i;
    }
    vector<pair<int, int>> b(m);
    for (auto& p : b) {
        cin >> p.first;
    }
    for (auto& p : b) {
        cin >> p.second;
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    int j = 0;
    int sum = 0;
    for (int i = 0; i < n; ++i) {
        while(j < m && b[j].first < a[i].first) {
            sum += b[j].second;
            ++j;
        }
        a[i].first = sum;
    }
    sort(a.begin(), a.end(), [](auto lhs, auto rhs) {
        return lhs.second < rhs.second;
    });
    for (auto [val, id] : a) {
        cout << val << " ";
    }
    return 0;
}
