A Derangement is a permutation p of 1,2,…,n where p_i=i for all i from 1 to n.
A rotation of a sequence a_1,a_2,… ,a_n with offset k (1≤k≤n) is equal to the sequence a_k,a_k+1,…,a_n,a_1,a_2,…,a_k−1. A sequence of length n has at most n distinct rotations.
Given a derangement D, let f(D) denote the number of distinct rotations of D that are also derangements. For example, f(\[2,1])=1, f(\[3,1,2])=2.
Given n and a prime number p, count the number of derangements D of 1,2,…,n such that f(D)=n−2, modulo p.
The single line of input contains two integers n (3≤n≤106) and p (108≤p≤109+7), where n is a permutation size, and p is a prime number.
Output a single integer, which is the number of derangements D of size n with f(D)=n−2, modulo p.