{ Free Pascal }

type
 Super=-10..100000000000000;

var
 n,m,k:Super;
 i:longint;
 m1,m2:array[0..100001] of Super;
 ms:array[0..100001] of Super;
 mans:array[0..100001] of Super;

begin
 assign(input,'pelmeni.in');
 assign(output,'pelmeni.out');
 reset(input);
 rewrite(output);

 readln(n,m);

 for i:=1 to n do
   read(m1[i]);
 for i:=1 to m do
   read(m2[i]);

 ms[1]:=m1[1];
 for i:=2 to n do
   ms[i]:=ms[i-1]+m1[i];


m2[0]:=0;
k:=1;

 for i:=1 to m do
    begin
       if m2[i]=m2[i-1] then
          mans[i]:=mans[i-1]
        else
            begin
              k:=k-1;
              repeat
                inc(k);
              until (m1[k+1]>m2[i]) or (k+1>n);
              mans[i]:=ms[k]+(n-k)*m2[i];
            end;
    end;

for i:=1 to m-1 do
 write(mans[i],' ');

writeln(mans[m]);

end.
