Modulo Query
You are given N cards, each containing a different natural number (1 to 300000). When you are asked a question, you should answer the maximum remainder obtained when dividing the number on the card you have by the number I said.
For example, suppose you have three cards with numbers 9, 3, and 8. If I say "4", find the remainder when you divide 9, 3, and 8 by 4. The remainders are 1, 3, and 0, respectively, but the largest remainder is 3, so the correct answer is 3.
Now, let's get started. What? It's difficult if there are too many cards? Well, that's true. Then, let's use a computer to find the maximum remainder. Please create a program that finds the largest remainder among the remainders obtained by dividing the numbers on the cards by the number asked. Note that questions can be asked multiple times, but the same number will not be asked twice.
Input
The input consists of a single data set in the following format:
N Q
c1 c2 ... cN
q1
q2
:
qQ
The first line contains the number of cards N (2 ≤ N ≤ 300000) and the number of questions Q (2 ≤ Q ≤ 100000) separated by a single space. The second line contains the numbers ci (1 ≤ ci ≤ 300000) written on the cards separated by a single space. The next Q lines contain the numbers qi (1 ≤ qi ≤ 300000) asked as questions.
Output
Output the maximum remainder for each question on a separate line.
Sample Input
3 3
9 3 8
4
6
5
Sample Output
3
3
4
