/* GCC */

#include <iostream>
#include <fstream>
#include <climits>
using namespace std;

typedef unsigned long long bigNum;

int main()
{
    bigNum X = 0;
    ifstream fin("pelmeni.in");
    ofstream fout("pelmeni.out");
    int n = 0, m = 0;
    fin >> n >> m;
    int* ak = new int[n];
    int* bl = new int[m];
    for (int i=0; i<n; ++i)
        fin >> ak[i];
    for (int i=0; i<m; ++i)
        fin >> bl[i];
    bigNum j = 0, lim = 0, tmp = 0, i = 0;
    for (i = 0; i<m - 1; ++i)
    {
        lim = bl[i];
        while (ak[j] < lim)
        {
            X += ak[j];
            j++;
        }
        tmp = lim * (n - j);
        fout << tmp + X << ' ';
    }
    lim = bl[i];
    while (ak[j] < lim)
    {
        X += ak[j];
        j++;
    }
    tmp = lim * (n - j);
    fout << tmp + X << endl;
    delete[] ak;
    delete[] bl;
    fin.close();
    fout.close();
    return 0;
}
