{ Free Pascal }
Var
  i,j,k,n,m:longint;
  ans:int64;
  a,b:array[1..1000001]of longint;
  inp,outp:text;
Begin
  Assign(inp,'pelmeni.in');
  Assign(outp,'pelmeni.out');
  Reset(inp);
  Rewrite(outp);
  Readln(inp,n,m);
  for i:=1 to n do
  Read(inp,a[i]);
  for j:=1 to m do
  Read(inp,b[j]);
  for j:=1 to m do
  Begin
    i:=1;
    ans:=0;
    while (b[j]>=a[i])and(i<=n) do
    inc(i);
    i:=i-1;
    ans:=(n-i)*b[j];
    for k:=1 to i do
    ans:=ans+a[k];
    if j<=m-1 then
    Write(outp,ans,' ')
    else
    Writeln(outp,ans);
  End;
  Close(inp);
  Close(outp);
End.