/* GCC */

#include <cstdio>

using namespace std;
typedef long long LL;

const int nMax = 100016;

int A[nMax];
int B[nMax];

int n, m;

int last_ind = 0;

int range_search (int x)
{
    if ( x <= A[0] )
        return 0;
    if (x > A[n-1])
        return -1;

    int left = last_ind;
    int right = n-1;

    while (left < right)
    {
        int middle = left + (right-left)/2;
        if (A[middle] >= x)
            right = middle;
        else
            left = middle + 1;
    }
    if (A[right] >= x)
        return right;
    return -1;
}

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

    bool bFirst = true;
    int index = 0;

    scanf ("%d %d", &n, &m);

    for (int i = 0; i < n; i++)
        scanf ("%d", &A[i]);
    for (int i = 0; i < m; i++)
        scanf ("%d", &B[i]);

    while (index < m && B[index] <= A[0])
    {
        if (bFirst)
        {
            printf ("%lld", B[index]*n);
            bFirst = false;
        }
        else
            printf (" %lld", B[index]*n);
        index++;
    }
    if (index  == m)
    {
        printf ("\n");
        return 0;
    }

    LL cur_sum = 0;
    int cur_ind  = 0;

    while (index < m)
    {
        int x = B[index];
        last_ind = cur_ind;
        cur_ind = range_search (x);

        if (cur_ind == -1)
            break;

        for (int i = last_ind; i < cur_ind; i++)
            cur_sum += A[i];
        while (B[index] == x)
        {
            if (bFirst)
            {
                printf ("%lld", cur_sum + 1ll*(n-cur_ind)*B[index]);
                bFirst = false;
            }
            else
                printf (" %lld", cur_sum + 1ll*(n-cur_ind)*B[index]);
            index++;
        }
    }

    if (index == m)
    {
        printf ("\n");
        return 0;
    }

    for (int i = last_ind; i < n; i++)
        cur_sum += A[i];

    while (index < m)
    {
        if (bFirst)
            {
                printf ("%lld", cur_sum);
                bFirst = false;
            }
            else
                printf (" %lld", cur_sum);
        index++;
    }

    printf ("\n");

    return 0;
}
