A Thue-Morse string of order k is a string of length 2k in which i-th symbol equals to 'A' if the number of 1-bits in binary representation of i−1 is even, and 'B' if it is odd.
A suffix array for string s of length n is a permutation suf of integers from 1 to n such that s\[suf\[1]..n], s\[suf\[2]..n], …, s\[suf\[n]..n] is the list of non-empty suffixes of s sorted in lexicographical order.
Let suf be the suffix array for Thue-Morse string of order k. You task is to calculate q values: suf\[p_1], suf\[p_2], …, suf\[p_q].
The first line of input contains two integers k and q: the order of Thue-Morse string and the number of queries (0≤k≤60, 1≤q≤105).
The second line contains q integers p_1, p_2, …, p_q separated by spaces: the required indices (1≤p_i≤2k).
Output q answers to the queries, separated by spaces.
Thue-Morse string of order 3 is "ABBABAAB".