program exhibit;
type
fxz1=array[1..1000000] of integer;
fxz2=array[1..2000] of longint;
var
f1,f2:text;
w,t,a,b,m,n,i:longint;
flag:boolean;
pic:fxz1;
num:fxz2;
procedure jin;
begin inc(w);
inc(num[pic[w]]);
end;
procedure suo;
begin dec(num[pic[t]]);
inc(t);
end;
procedure pan(var flag:boolean);
var
i:longint;
begin flag:=true;
for i:=1 to m do
if num[i]=0 then
begin flag:=false;break;end;
end;
begin
assign(f1,'exhibit.in');
assign(f2,'exhibit.out');
reset(f1);rewrite(f2);
readln(f1,n,m);
for i:=1 to n do read(f1,pic[i]);
t:=1;w:=0;a:=0;b:=n;
repeat flag:=false;
while flag=false do
begin jin;pan(flag);end;
if w-t<b-a then begin a:=t;b:=w;end;
while flag do
begin suo;pan(flag);end;
dec(t);inc(num[pic[t]]);
if w-t<b-a then begin a:=t;b:=w;end;
until (a-b=m-1)or(w=n);
writeln(f2,a,' ',b);
close(f1);close(f2);
end.