Maximal Number of Divisors#3846

Maximal Number of Divisors

30 seconds
256 megabytes
Easy

Help Mr. Strange to solve the following problem: "Find the maximum number of positive divisors of all integers in the interval from up to and including (1 \leq N \leq 42^{42})". Since it is Mr. Strange who solves the problem, the situation is complicated by the fact that he dislikes number . Therefore, you should not find the actual maximum number of divisors of all possible numbers from to , but the maximum number of divisors only for numbers from to , which are not divisible by .

Input

The input file contains several data sets. Your program reads the number of data sets (2 \leq T \leq 42), followed by the actual data sets. Each data set contains exactly three lines. The first line contains the number (which is disliked by Mr. Strange; 2 \leq P \leq 1000000007). The second line contains the number (1 \leq K \leq 42) of intervals for which the solution is to be found. The third line contains space-separated integers, N_i, each in the range 1 \leq N_i \leq 42^{42} representing the upper limit of each interval.

Output

The result for each of the data sets should be written on separate lines. The results for the intervals [1, N_i] should be space-separated.

Examples

Example 1

Loading
Loading

Note

Explanation. In each data set you are asked to find the maximal number of divisors for numbers in intervals and . If Mr. Strange dislikes P = 13, the maximum number of divisors is and is reached for the numbers (divisors , , and ) and (divisors , , and ); the maximum number of divisors is reached for the number . If Mr. Strange dislikes P = 6, numbers , , , , , , are prohibited. So, the same maximum is reached only for the number ; no number in the interval has divisors, but the maximum number is reached for the number .