Given an array of length and queries, print the closest number to the value given in each query.
Input Specification
The first line will contain integer and , the length of the array and the number of queries, respectively. The next line will contain integers, the values in the array. It is guaranteed that these values will be smaller than . The next lines will contain an integer , the value that you are to find the closest number to.
Output Specification
For each query, one integer that is either the integer in the array that is closest to . If there are multiple numbers that have the same distance from print the largest one.
Subtasks
Subtask 1 (50%)
Subtask 2 (50%)
No further constraints.
Sample Input 1
5 5
2 3 6 9 10
1
2
6
13
9
Sample Output 1
2
2
6
10
9
Comments