A Leapfrog in the Array
시간 제한2초메모리 제한1024 MB
가장 오른쪽의 비어 있지 않은 칸에 든 수를 왼쪽의 가장 가까운 빈칸으로 옮기는 과정을 끝까지 수행했을 때, 각 질의 x번째 칸에 오는 수를 구한다.
문제
Dima is a beginner programmer. During his working process, he regularly has to repeat the following operation again and again: to remove every second element from the array. One day he has been bored with easy solutions of this problem, and he has come up with the following extravagant algorithm.
Let's consider that initially array contains numbers from to and the number is located in the cell with the index (Indices are numbered starting from one) and other cells of the array are empty. Each step Dima selects a non-empty array cell with the maximum index and moves the number written in it to the nearest empty cell to the left of the selected one. The process continues until all numbers will appear in the first cells of the array. For example if , the array is changing as follows:

You have to write a program that allows you to determine what number will be in the cell with index () after Dima's algorithm finishes.
입력
The first line contains two integers and (, ), the number of elements in the array and the number of queries for which it is needed to find the answer.
Next lines contain integers (), the indices of cells for which it is necessary to output their content after Dima's algorithm finishes.
출력
For each of queries output one integer number, the value that will appear in the corresponding array cell after Dima's algorithm finishes.