program wz;
var
a,b:array[0..100001]of int64;
m,n,ans,num,max,s:int64;
i,j:longint;
procedure sort(x,y:longint);
var
i,j,mid,t:longint;
begin
i:=x;
j:=y;
mid:=b[(i+y) div 2];
repeat
while b[i]<mid do inc(i);
while b[j]>mid do dec(j);
if i<=j then
begin
t:=b[i];
b[i]:=b[j];
b[j]:=t;
inc(i);
dec(j);
end;
until i>j;
if i<y then sort(i,y);
if j>x then sort(x,j);
end;
begin
assign(input,'jumpk.in');
assign(output,'jumpk.out');
reset(input);
rewrite(output);
readln(n,m);
for i:=1 to n do
begin
read(a[i]);
s:=s+i-1;
b[i]:=a[i]-s;
end;
sort(1,n);
num:=1; max:=0; ans:=0;
for i:=1 to n do
if b[i]=b[i+1] then inc(num) else
begin
if max<num then begin max:=num;ans:=b[i];end;
num:=1;
end;
for i:=1 to n do
b[i]:=ans+(i*(i-1) div 2);
writeln(n-max);
writeln(b[m]);
close(input);
close(output);
end.