/* GCC */
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <queue>
#include <sstream>

using namespace std;

long long n, m, i, j, a[100010], b, otv, sum;

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

    sum = 0;
    j = 0;
    //cin >> n >> m;
    scanf("%I64d %I64d", &n, &m);
    for(i = 0; i < n; i++)
        scanf("%I64d", &a[i]);
        //cin >> a[i];
    for(i = 0; i < m - 1; i++)
    {
        otv = 0;
        //cin >> b;
        scanf("%I64d", &b);

        while(j < n && a[j] < b)
        {
            sum += a[j];
            j++;
        }

        otv = otv + sum;

        otv = otv + (b * (n - j));

        //cout << otv << " ";
        printf("%I64d ", otv);
    }

    //cerr << sum << " " << j << endl;

    otv = 0;
    //cin >> b;
    scanf("%I64d", &b);

    while(j < n && a[j] < b)
    {
        sum += a[j];
        j++;
    }

    otv = otv + sum;

    otv = otv + (b * (n - j));

    //cout << otv << endl;
    printf("%I64d\n", otv);

    return 0;
}
