program MayLava;
var
a:array[1..1000000]of integer;
b:array[1..2000]of integer;
n,m,p,q:integer;
procedure start;
var
f:text;
i:integer;
begin
assign(f,'exhibit.in');
reset(f);
readln(f,n,m);
for i:=1 to n do
read(f,a[i]);
close(f);
fillchar(b,sizeof(b),0);
for i:=1 to n do
b[a[i]]:=b[a[i]]+1;
p:=1;
q:=n;
end;
procedure main;
var
i:integer;
begin
for i:=n downto i do
if b[a[i]]>1 then begin
dec(b[a[i]]);
dec(q);
end
else break;
for i:=1 to q do
if b[a[i]]>1 then begin
dec(b[a[i]]);
inc(p);
end
else break;
end;
procedure print;
var
f:text;
begin
assign(f,'exhibit.out');
rewrite(f);
writeln(f,p,' ',q);
close(f);
end;
{===========MAIN==========}
BEGIN
start;
main;
print;
END.