Secret Number is a number guessing game where the questioner thinks of a number between 1 and 100. We can ask about a number, and the questioner will tell us if it is higher or lower than his number.
We know that the fastest way to guess the number is by asking about the middle value each time, reducing the options by half. This idea is called Binary Search.
Now, there's no questioner to answer you, and this game will be played T times. Each time, you'll receive a number M, and you need to find its position P in a sorted array A of length N.
Hint:
If you get a TLE, try to think about how to use the number guessing game strategy to quickly find M.
The first line contains two integers N and T. N represents the length of the array, and T represents the number of games to be played.
The second line contains N numbers, representing the numbers Ai in the array, guaranteed to be sorted in increasing order. Each number appears only once.
The following T lines each contain a number Mj , representing the number to find in the jth round. Mj is guaranteed to be in array A.
Output T lines, each containing a number Pj, representing the position of Mj in the array for the jth round.
Please remember to print "\n" at the end.