program P922;
var
n,m,i,sum,lv:longint;
a:array[1..1000000] of longint;
begin
assign(input,'tenhous.in');
reset(input);
assign(output,'tenhous.out');
rewrite(output);
readln(n,m);
for i:=1 to n do read(a[i]);
for i:=1 to n do
begin
inc(sum,a[i]);
if sum>=m then begin sum:=sum-m; inc(lv); end;
if i<n then sum:=sum div 2;
end;
writeln(lv);
writeln(sum);
end.