n,m = map(int,input().split())
A = [0,1]
B = [0,1]
C = [0,1]
for i in range(1,2*n):
  a,b,c = A[-1],B[-1],C[-1]
  A.append((a + (i + 1)*b) % m)
  B.append((a + b + (i + 1)*c) % m)
  C.append((a + b + c) % m)

ans = 1
for i in range(1,2*n-1,2):
  ans *= C[i]
  ans %= m
for i in range(1,2*n):
  ans *= i
  ans %= m
print(ans)