This problem is a programming version of Problem 172 from projecteuler.net
How many positive -digit numbers (without leading zeroes) are there such that no digit occurs more than times in ? Output the answer modulo .
The first line of input contains two integers and . Here, is the number of queries. The following lines contain an integer each.
For each query, print the integer which is the answer to the problem modulo .
Sample Input 0
Sample Output 0
For the first query, each -digit number is valid. For the second query, each -digit number except for , , , , , , , , and is valid.