program exhibit;
var
t:array [1..1000000] of integer;
j,i,min,mina,minb,n,m:longint;
b:array [1..2000] of boolean;
function check:boolean;
var i:integer;
begin
check:=true;
for i:=1 to m do if b[i]=false then begin
check:=false;
break;
end;
end;
begin
fillchar (b,sizeof(b),0);
assign (input,'exhibit.in');
reset (input);
readln (n,m);
for i:=1 to n do read (t[i]);
close (input);
assign (output,'exhibit.out');
rewrite (output);
i:=1;min:=maxlongint;
for j:=1 to n do begin
if b[t[j]]=false then begin
b[t[j]]:=true;
if (check) and (j-i+1<min) then begin
min:=j-i+1;
mina:=i;minb:=j;
end;
end
else if t[j]=t[i] then inc(i);
end;
writeln (mina,' ',minb);
close (output);
end.