var
s:array [1..1000000]of longint;
n,m,i,x,d,j:longint;
begin
assign(input,'tenhous.in');
reset(input);
assign(output,'tenhous.out');
rewrite(output);
readln(n,m);
for i:=1 to n do
read(s[i]);
for j:=1 to n-1 do
begin
x:=x+s[j];
if x-m>0 then
begin
d:=d+x div m;
x:=x mod m;
end;
x:=x shr 1;
end;
if x-m>0 then
begin
d:=d+x div m;
x:=x mod m;
end;
x:=x+s[n];
writeln(d);
writeln(x);
close(input);
close(output);
end.