program ex;
type
sz=array[1..2000]of integer;
ss=array[1..1000000]of integer;
var
g:sz;
f:ss;
n,m:longint;
procedure init;
var
i:integer;
begin
assign(input,'exhibit.in');
assign(output,'exhibit.out');
reset(input);
rewrite(output);
readln(n,m);
for i:=1 to n do read(f[i]);
close(input);
end;
procedure main;
var
tot,a,b:integer;
head,tail:integer;
begin
a:=1;
b:=n;
head:=1;
tail:=1;
tot:=1;
g[f[head]]:=1;
while head<>n do
begin
if tot=m then
begin
if tail-head<b-a then
begin
a:=head;
b:=tail;
end;
dec(g[f[head]]);
if g[f[head]]=0 then dec(tot);
inc(head);
end
else
if tail<>n then
begin
inc(tail);
if g[f[tail]]=0 then inc(tot);
inc(g[f[tail]]);
end
else inc(head);
end;
writeln(a,' ',b);
end;
begin
init;
main;
close(output);
end.