program ex3;
var
n,m,i,sum,total,P,T,ll,rr,min:longint;
visit:array[1..2000] of longint;
Q:array[1..10000000] of integer;
begin
assign(input,'exhibit.in');
assign(output,'exhibit.out');
reset(input); rewrite(output);
read(n,m);
P:=1; T:=0; min:=maxlongint;
for i:=1 to n do
begin
read(sum);
inc(visit[sum]);
T:=T+1;
Q[T]:=sum;
if visit[sum]=1
then inc(total);
if total=m
then
while total=m do
begin
if T-P+1<min
then
begin
min:=T-P+1;
ll:=P;
rr:=T
end;
dec(visit[Q[P]]);
if visit[Q[P]]=0
then
dec(total);
inc(P);
end;
end;
writeln(ll);
writeln(rr);
close(input); close(output);
end.