program exhibit;
var
pic:array[1..1000000]of longint;
man:array[1..2000]of longint;
maxh,maxf,maxn,h,f,n,picture,artist,i,n2:longint;
begin
assign(input,'exhibit.in');
assign(output,'exhibit.out');
reset(input);
rewrite(output);
readln(picture,artist);
maxn:=-1;
h:=1;
fillchar(man,sizeof(man),0);
n2:=0;
for i:=1 to picture do
read(pic[i]);
readln;
for i:=1 to picture do
begin
if man[pic[i]]=0 then begin
man[pic[i]]:=1;
n2:=n2+1;{num of artist}
n:=n+1; {num of money}
f:=i;
end
else begin
man[pic[i]]:=man[pic[i]]+1;
n:=n+1; {num of money}
f:=f+1;
if pic[h]=pic[i] then begin
while man[pic[h]]>1 do
begin
man[pic[h]]:=man[pic[h]]-1;
if man[pic[h]]=0 then n2:=n2-1;
n:=n-1;
h:=h+1;
end;
end;
end;
if n2=artist then begin
if (n<maxn)or(maxn=-1) then begin
maxn:=n;
maxh:=h;
maxf:=f;
end;
end;
end;
writeln(maxh,' ',maxf);
close(input);
close(output);
end.