GrandPaPà calls applied to a permutation as the number of pairs such that and . For example, , and .
Given and a permutation of length , we define a permutation of length to be -special if and only if:
- is lexicographically smaller than , and
- .
Your task is to count for each the number of -special permutations modulo .
A permutation is an array consisting of distinct integers from to in arbitrary order. For example, is a permutation, but is not a permutation ( appears twice in the array) and is also not a permutation ( but there is in the array).
A permutation of length is lexicographically smaller than a permutation of length if and only if the following holds: in the first position where and differ, the permutation has a smaller element than the corresponding element in .
Input
The first line contains two integers and (, ) — the length of the permutation and the required modulo.
The second line contains distinct integers () — the permutation .
Output
Print integers, where the -th integer is the number of -special permutations modulo .
Example 1
stdin
4 666012
1 3 4 2
stdout
0 0 2 1
Note
The permutations that are lexicographically smaller than are:
- , ;
- , ;
- , .
Thus our answer is .
Example 2
stdin
10 60
10 9 8 7 6 5 4 3 2 1
stdout
0 53 20 32 14 14 32 20 53 1