Brunhilda's Birthday

No attempts yetTime limit1sMemory limit256 MB

Problem

Brunhilda has invented the following game for her birthday party. The children run around until some number $k$ is called out. When $k$ is announced, the children form groups of exactly $k$. As long as at least $k$ children remain ungrouped, another group of $k$ is formed; in the end the fewer than $k$ children who cannot fill a group are eliminated from the game. The children who did form complete groups stay in the game. More numbers are called out, and the game ends once no children remain.

In other words, when there are $n$ children and $k$ is called, $\lfloor n/k \rfloor$ groups are formed, so $k \cdot \lfloor n/k \rfloor$ children stay and the remaining $n \bmod k$ children are eliminated.

Brunhilda's father Wotan calls out the numbers. He may not call an arbitrary number: each call must be chosen from a given list of $m$ distinct prime numbers, and he may reuse the same prime as often as he likes. Wotan wants to finish the game in as few calls as possible.

The number of children is not fixed yet. For each of $Q$ possible party sizes $n_1, \dots, n_Q$, determine the least number of calls Wotan needs to end the game. If the game can never be ended, output the string oo (two lowercase letters o) instead, meaning infinity.

Input

The first line contains the integers $m$ and $Q$.

The second line contains the $m$ distinct primes $p_i$ ($1 \le i \le m$) in ascending order: the numbers Wotan may call.

Each of the following $Q$ lines contains one integer $n_j$ ($1 \le j \le Q$): a possible number of children.

Output

Output $Q$ lines. The $j$-th line contains the answer for $n_j$: the least number of calls Wotan needs if the game can be ended (an integer), or the string oo otherwise.

Constraints

  • $1 \le m \le 100,000$
  • $1 \le Q \le 100,000$
  • $2 \le p_i \le 10,000,000$
  • $1 \le n_j \le 10,000,000$
  • The $p_i$ are distinct primes given in ascending order.