var n,m,t,level,now:int64;
i:longint;
begin
assign(input,'tenhous.in');
assign(output,'tenhous.out');
reset(input);
rewrite(output);
readln(n,m);
for i:=1 to n-1 do
begin
read(t);
now:=now+t;
if now>=m then
begin
now:=now-m;
inc(level);
end;
now:=now shr 1;
end;
read(t);
now:=now+t;
if now>=m then
begin
now:=now-m;
inc(level);
end;
writeln(level);
writeln(now);
close(input);
close(output);
end.