After a long day at work, Santa comes home only to discover that his newborn reindeer have been numbered wrong by Mrs. Clause.
Normally, the baby reindeer would be numbered . However, Mrs. Clause has absentmindedly numbered the th reindeer the value of the th prime number instead.
Santa is tired, so he wants you to deal with the logistic problems that arise with this new numbering. His assistant will ask you questions. The th question will ask you for the regular number of the reindeer with the current number . You must find the value of this regular number or that no reindeer is labeled the given number.
Input Specification
The first line will contain two space-separated integers, and .
The next lines will each contain one integer, .
Output Specification
For each question, output the regular number of the reindeer in question on a separate line. If there is no reindeer with that number, output -1
instead.
Constraints
Subtask 1 [30%]
Subtask 2 [70%]
No further constraints.
Sample Input
5 4
2
5
11
20
Sample Output
1
3
5
-1
Explanation for Sample Output
is the first prime number, so its regular number is .
and are the third and fifth prime numbers respectively, so their regular numbers are and .
is not a prime number, so it has no regular number attached to it.
Comments