uses math;var a,b,p:array [0..2000005] of longint; n,pp,i,j,x:longint; ans:int64;begin read(n,pp); for i:=2 to n*2 do begin if a[i]=0 then begin inc(p[0]); p[p[0]]:=i; a[i]:=p[0]; end; for j:=1 to p[0] do if (i*p[j]<=n*2) then a[i*p[j]]:=j else break; end; for i:=n+1 to n*2 do begin x:=i; while x<>1 do begin inc(b[a[x]]); x:=x div p[a[x]]; end; end; for i:=1 to n+1 do begin x:=i; while x<>1 do begin dec(b[a[x]]); x:=x div p[a[x]]; end; end; ans:=1; for i:=1 to p[0] do for j:=1 to b[i] do ans:=ans*p[i] mod pp; write(ans);end.