/* GCC */
#include <iostream>
#include <vector>
using namespace std;
int main(){
    freopen("pelmeni.in", "r", stdin);
    freopen("pelmeni.out", "w", stdout);
    
    int n,m;
    scanf("%d %d", &n, &m);
    vector < int > a(n);
    vector < int > b(m);
    vector < int > suma1(n);
    vector < int > suma2(n);
    
    for (int i=0; i<n; i++){
            scanf("%d", &a[i]);
            if (i==0){
                      suma1[0]=a[0]/1000000007;
                      suma2[0]=a[0]%1000000007;
                      }
            else{
            suma1[i]=suma1[i-1]+(suma2[i-1]+a[i])/1000000007;
            suma2[i]=(suma2[i-1]+a[i])%1000000007;
            }
    }
    for (int i=0; i<m; i++)
    scanf("%d", &b[i]);
    int mn=0; int mx=n-1;
    
    int tec, tecmn, tecmx;
    long long kil;
    for (int i=0; i<m-1; i++)
    if (a[0]>=b[i]) printf("%d ", b[i]*n);
    else{
        tecmn=mn; tecmx=mx;
        tec=(tecmn+tecmx)/2;
        while (!((a[tec-1]<b[i]) && (a[tec]>=b[i])))
        if (a[tec-1]>=b[i]) tec=(tecmn+tec-1)/2;
        else tec=(tecmx+tec+1)/2;
        mn=tec;
        kil=suma1[tec-1]*1000000007+suma2[tec-1]+b[i]*(n-tec);
        printf("%d ", kil);
        }
    
    if (a[0]>=b[m-1]) printf("%d ", b[m-1]*n);
    else{
        tecmn=mn; tecmx=mx;
        tec=(tecmn+tecmx)/2;
        while (!((a[tec-1]<b[m-1]) && (a[tec]>=b[m-1])))
        if (a[tec-1]>=b[m-1]) tec=(tecmn+tec-1)/2;
        else tec=(tecmx+tec+1)/2;
        mn=tec;
        kil=suma1[tec-1]*1000000007+suma2[tec-1]+b[m-1]*(n-tec);
        printf("%d\n", kil);
        }
    fclose(stdin);
    fclose(stdout);
}
