/* GCC */
#include <iostream>
#include <vector>
using namespace std;
vector < int > A;
int BF(int xd, int t){
    int tl=xd, tr=A.size()-1, tm, tk;
    if(tl==tr || t>A[tr]) return tr;
    bool f=true;
    while(f){
         tm=(tl+tr)/2;
         tk=tm+1;
         if(A[tm]<=t && A[tk]>t) f=false;
         else{
              if(A[tm]<t) tl=tk;
              if(A[tm]>=t) tr=tm;
         }   
    }
    return tm;
}
int main(){
    freopen("pelmeni.in", "r", stdin);
    freopen("pelmeni.out", "w", stdout);
    int m, n, x, B, k, p=0, Bp=0;
    unsigned long res;
    scanf("%d %d", &n, &m);
    vector < unsigned long  > S;
    unsigned long sum=0;
    for(int i=0;i<n;i++){
            scanf("%d", &x);
            sum+=x;
            A.push_back(x);
            S.push_back(sum);
    }
    for(int i=0;i<m;i++){
            scanf("%d", &B);
            if(B!=Bp){
                      if(B<A[0]) res=n*B;
                                 else{
                                      k=BF(p,B);
                                      p=k;
                                      res=S[k]+(n-k-1)*B;
                                 }
                      Bp=B;
            }
            if(i==0) printf("%d", res);
            else printf(" %d", res);
    }
    printf("\n");
    fclose(stdin);
    fclose(stdout);
}
