// Buon buon nen lam` thoi :D
type int = longint;
long = int64;
const maxn = trunc(1e5);
MODD = trunc(1e9);
lim = maxn * 2;
fi = 'TREELINE.INP';
fo = 'TREELINE.OUT';
var pr, pow: array[0..lim] of long;
a: array[0..maxn] of int;
np: array[0..lim] of boolean;
i, n, h, cnt: int;
procedure sieve;
var i, j:int;
begin
for i:=2 to trunc(sqrt(lim)) do
if not np[i] then
for j:=i to lim div i do
np[i * j]:=true;
for i:=2 to lim do
if not np[i] then
begin
inc(cnt);
pr[cnt]:=i;
end;
end;
function powmod(a, n: long):long;
var res: long;
begin
res:=1;
while n <> 0 do
begin
if n and 1 = 1 then res:=(res * a) mod MODD;
a:=(a * a) mod MODD;
n:=n shr 1;
end;
exit(res);
end;
procedure analysis(n: long; decrease: boolean);
var i: int;
x: long;
begin
for i:=1 to cnt do
begin
x:=pr[i];
while x <= n do
begin
if decrease then dec(pow[i], n div x)
else inc(pow[i], n div x);
x:=x * pr[i];
end;
end;
end;
procedure calc;
begin
sieve; inc(n);
analysis(2 * n, false);
analysis(n + 1, true);
analysis(n, true);
end;
procedure solve;
var i, ans: int;
res: long;
begin
ans:=2;
for i:=n - 1 downto 1 do
if a[i] < a[i + 1] then inc(ans)
else break;
writeln(ans);
calc; res:=1;
for i:=1 to cnt do
res:= (res * powmod(pr[i], pow[i])) mod MODD;
writeln(res);
end;
begin
assign(input, fi);reset(input);
assign(output, fo);rewrite(output);
readln(n, h);
for i:=1 to n do read(a[i]);
solve;
close(input);close(output);
end.