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