{var n,k,fin,ini,pimax,i,max,pfmax:longint;
a,b:array[0..500001] of longint;
f,g:text;
function secv(i:longint; var pi,pf:longint):boolean;
begin
pi:=i;
pf:=i;
while (pf-pi+1<k) and (a[pi-1]>=a[i]) and (pi>1) do
dec(pi);
while (pf-pi+1<k) and (a[pf+1]>=a[i]) and (pf<n) do
inc(pf);
if pf-pi+1=k then
secv:=true
else secv:=false;
end;
begin
assign(f,'secventa.in');
assign(g,'secventa.out');
reset(f);
rewrite(g);
read(f,n,k);
max:=-maxlongint;
for i:=1 to n do read (f,a[i]);
for i:=1 to n do
if a[i]>max then
if secv(i,ini,fin) then begin
max:=a[i];
pimax:=ini;
pfmax:=fin;
end;
writeln(g,pimax,' ',pfmax,' ',max);
close(f);
close(g);
end.}
var n,k,i,st,en,nr:longint;
a,b,t:array[0..500001] of longint;
f,g:text;
procedure merge(si,sj:longint);
var nr,di,dj,i,j,m:longint;
begin
if si<sj then begin
m:=(si+sj)div 2;
merge(si,m);
merge(m+1,sj);
i:=si;
j:=m+1;
nr:=0;
while (i<=m) and (j<=sj) do
if a[b[i]]<=a[b[j]] then begin
inc(nr);
t[nr]:=b[i];
inc(i);
end else begin
inc(nr);
t[nr]:=b[j];
inc(j);
end;
while (i<=m) do begin
inc(nr);
t[nr]:=b[i];
inc(i);
end;
while (j<=sj) do begin
inc(nr);
t[nr]:=b[j];
inc(j);
end;
for i:=1 to nr do
b[si+i-1]:=t[i];
end;
end;
begin
assign(f,'secventa.in');
assign(g,'secventa.out');
reset(f);
rewrite(g);
read(f,n,k);
for i:=1 to n do begin
read(f,a[i]);
b[i]:=i;
end;
merge(1,n);
for i:=n-k+1 downto 1 do begin
nr:=1;
st:=b[i]-1;
while (st>=1) and (nr<k) and (a[st]>=a[b[i]]) do begin
inc(nr);
dec(st);
end;
en:=b[i]+1;
while (en<=n) and (nr<k) and (a[en]>=a[b[i]]) do begin
inc(nr);
inc(en);
end;
if nr=k then break;
end;
writeln(g,st+1,' ',en-1,' ',a[b[i]]);
close(f);
close(g);
end.
end.