{ Free Pascal }
var a,x,res:array[0..100000] of longint;
    i,j,n,m,l:longint;
procedure pr;
begin
 for j:=1 to m do
  begin
   if x[j]=x[j-1] then
    res[j]:=res[j-1]
   else
   begin
   i:=1;
   while a[i]<x[j] do
    begin
     res[j]:=res[j]+a[i];
     inc(i);
    end;
    res[j]:=res[j]+(n-i+1)*x[j];
  end;
 end;
end;
begin
 assign(input,'pelmeni.in');
 assign(output,'pelmeni.out');
 reset(input);
 rewrite(output);
 readln(input,n,m);
 for i:=1 to n do
  read(input,a[i]);
 for i:=1 to m do
  read(input,x[i]);
 for i:=0 to m do
  res[i]:=0;
 x[0]:=0;
 pr;
 for i:=1 to m do
  write(output,res[i],' ');
 close(input);
 close(output);
end.
