/* GCC */
#include <iostream>
using namespace std;
int n,m,a[100001],b[100001];
int binar(int k,int start,int end)
{
    if ((end-start)<=1) {if (a[end]>k) return start;else return end;};
    if (a[(start+end)/2]>k) return binar(k,start,(start+end)/2);else return binar(k,(start+end)/2,end);
}
int main()
{
    freopen("pelmeni.in","r",stdin);
    freopen("pelmeni.out","w",stdout);
    cin >> n >> m;
    for (int i=1;i<=n;i++) cin >> a[i];
    for (int i=1;i<=m;i++) cin >> b[i];
    long long sum[100001];
    sum[0]=0;
    for (int i=1;i<=n;i++) sum[i]=sum[i-1]+a[i]; 
    for (int i=1;i<=m;i++)
    {
        if (b[i]<=a[1]) cout << b[i]*n;else
        if (b[i]>=a[n]) cout << sum[n];else
        {
            int bin=binar(b[i],1,n);
            cout << sum[bin]+(n-bin)*b[i];
        }
        if (i==m) cout << endl;else cout << " ";
    }  
}
