Lidia Perovskaya

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

nn players are playing in an elimination tournament. The tournament is a sequence of n1n - 1 matches. Each match consists of two people playing against each other. One of them loses and is eliminated from the tournament (i.e. he can't participate in any further matches) and the other one wins and is not eliminated. The last match is called the final, because it consists of the only two not eliminated players. No two consecutive matches, none of which is the final, may share a participant.

How many different possible tournaments are there? Two tournaments are considered different if there exists a pair of players which played against each other in one of them but didn't in the other.

Output the correct answer modulo a prime number mm. Formally, if the actual answer is yy and your answer is xx, it will be considered correct if 263x<263-2^{63} \leq x < 2^{63} and xyx-y is divisible by mm.

입력

The only line contains two integers nn and mm (2n106,106+3 m109+92 \leq n \leq 10^6, 10^6 + 3  \leq m \leq 10^9+9, mm is prime), the number of players and the modulo.

출력

Print a single integer --- the number of possible tournaments modulo mm.