program cch(input,output);
var
i,j,n,m,maxi,maxj,num:longint;
a:array[1..1000000] of integer;
f:array[1..2000] of longint;
begin
assign(input,'exhibit.in');
assign(output,'exhibit.out');
reset(input);
rewrite(output);
readln(n,m);
for i:=1 to n do read(a[i]);
for i:=1 to m do f[i]:=0;
j:=1; i:=1; num:=0;
maxi:=1; maxj:=n;
while j<=n do
begin
while (j<=n)and(num<>m) do
begin
if f[a[j]]=0 then inc(num);
inc(f[a[j]]);
inc(j);
end;
if j>n then break;
dec(j);
while (i<=n)and(j<=n)and(num=m) do
begin
dec(f[a[i]]);
if f[a[i]]=0 then dec(num);
inc(i);
end;
if i>n then break;
dec(i);
if ((j-i)<(maxj-maxi))and(i<j) then
begin
maxj:=j;
maxi:=i;
end;
inc(i);
end;
write(maxi,' ',maxj);
close(input);
close(output);
end.