program MayLava;
var
a,b:array[0..1000001]of longint;
p,q,total,painter,n,m,min,x,y:longint;
procedure start;
var
i:longint;
f:text;
begin
assign(f,'exhibit.in');
reset(f);
readln(f,n,m);
for i:=1 to n do
read(f,a[i]);
close(f);
p:=0;
q:=0;
total:=0;
painter:=0;
min:=maxint;
end;
procedure main;
var
i,j:longint;
begin
while (p<n) or ((p=n) and (painter<m)) do begin
if painter<m then begin
inc(p);
if b[a[p]]=0 then inc(painter);
inc(b[a[p]]);
inc(total);
if painter=m then if total<min then begin min:=total; x:=q; y:=p; end;
end;
if (total>=m) and (painter=m) then begin
inc(q);
dec(b[a[q]]);
if b[a[q]]=0 then begin
if painter=m then
if total<min then begin min:=total; x:=q; y:=p; end;
dec(painter);
end;
dec(total);
end;
end;
end;
procedure print;
var
f:text;
begin
assign(f,'exhibit.out');
rewrite(f);
if x=0 then inc(x);
writeln(f,x,' ',y);
close(f);
end;
BEGIN
start;
main;
print;
END.