{ Free Pascal }
var f,g:text;
    i1,i,n,m:longint;
    a:array [1..100000] of longint;
    b,s:array[0..100000] of int64;
    ans:int64;

BEGIN
 assign(f,'pelmeni.in'); reset(f); assign(g,'pelmeni.out'); rewrite(g);
 Read(f,n,m);
 s[0]:=0;
 for i:=1 to n do begin
  read (f,a[i]);
  s[i]:=s[i-1]+a[i];
 end;
 for i:=1 to m do read (f,b[i]);
 i1:=1;

 for i:=1 to m-1 do begin
  dec(i1);
  repeat inc(i1)
  until a[i1]>=b[i];
  ans:=((n-i1+1)*b[i]) + s[i1-1];
  Write(g,ans,' ');
 end;

  dec(i1);
  repeat inc(i1)
  until a[i1]>=b[m];
  ans:=((n-i1+1)*b[m]) + s[i1-1];
  Writeln(g,ans);
 close(f); close(g);
END.