Problem Postmortem


Submit solution

Points: 1
Time limit: 1.5s
Python 3 2.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C, C++, Java, Python

At the AUCPL inc problemsetting department, it is customary for a postmortem to be held monthly, where all unclear statements, typos, and broken test cases from the previous month are reviewed and reflected on. Before each issue can be presented, its memo needs to be reviewed by exactly one department VP to ensure it isn't incorrect or too embarrassing.

The department has n VPs, with IDs 1 through n. Each VP is also assigned a clearance tier, which is a positive integer. Each postmortem memo additionally has a severity score d. Each memo can only be reviewed by a VP whose clearance tier divides d exactly (no remainder). If multiple VPs are eligible, the memo goes to the one with the highest clearance tier. If there is still a tie (i.e. multiple VPs have the same clearance tier), the one with the smallest ID is chosen.

Given a list of q memos, each with severity score d_i, determine which department VP should review each memo in time for the postmortem meeting.

Input

The first line contains two integers n and q (1 \leq n,q \leq 10^5) - the number of department VPs and the number of postmortem memos.

The second line contains n integers c_1\ \dots\ c_n (1 \leq c_i \leq 10^5), the clearance tier of each department VP.

The next line contains q integers d_1\ \dots\ d_q (1 \leq d_i \leq 10^5), the severity score of each postmortem memo.

Output

For each memo, print a single integer - the ID number of the department VP who reviews it. It is guaranteed that for each memo, at least one VP has a clearance tier that divides d_i.

Example

Input 1
4 3
6 3 6 2
6 3 10
Output 1
1
2
4

For the first memo, all of the VPs have clearance tiers that divide the severity score 6. There are also multiple VPs with the highest such score, 6, so the one with the smallest ID is picked.

For the second and third memos, only a single VP has an eligible clearance tier.

Input 2
5 4
4 2 8 1 8
8 4 7 1
Output 2
3
1
4
4
Input 3
6 5
3 5 15 5 9 1
15 9 5 30 1
Output 3
3
5
2
3
6

Comments

There are no comments at the moment.