/* GCC */
#include <cstdio>
#include <iostream>

using namespace std;

long n, m, a[100000], b[100000];
long long res[100000];

int main() {
    freopen("pelmeni.in", "r", stdin);
    freopen("pelmeni.out", "w", stdout);

    scanf("%ld%ld", &n, &m);
    for(long i = 0; i < n; i++) scanf("%ld", a + i);
    for(long i = 0; i < m; i++) scanf("%ld", b + i);

    long long sum = 0;
    for(long bi = 0, ai = 0; bi < m; bi++) {
        for(; ai < n && a[ai] <= b[bi]; ai++) {
            sum += a[ai];
        }
        res[bi] = sum + (n - ai) * (long long)b[bi];
    }

    cout << res[0];
    for(long i = 1; i < m; i++) {
        cout << ' ' << res[i];
    }
    cout << endl;

    return 0;
}
