program exhibit;
var a:array[1..1000000]of longint;
bo:array[1..2000]of longint;
t,k,m,n,j,min,x,y,re:longint;
g:text;
procedure search(i:longint);
var j:longint;
begin
for j:=i+1 to t do
if a[j]=1 then
begin
min:=j;
bo[k]:=t;
exit;
end;
end;
begin
assign(g,'exhibit.in');
reset(g);
readln(g,m,n);
min:=1;
for t:=1 to m do
begin
read(g,k);
a[t]:=1;
if bo[k]=0 then
begin
inc(j);
bo[k]:=t;
end
else
begin
if bo[k]=min then search(bo[k])
else begin a[bo[k]]:=0;bo[k]:=t;end;
end;
if (j=n)and((t-min<re)or(re=0)) then
begin
re:=t-min;
x:=min;
y:=t;
end;
end;
assign(g,'exhibit.out');
rewrite(g);
writeln(g,x,' ',y);
close(g);
end.