#Lutece3307. Schedule Planning

Schedule Planning

Description

In the year of 114514114514, the annual UESTC Fun Programming Contest is about to kick off. As the number of participants is increasing explosively, for example, last year, 19198101919810 students signed up for the competition. In order to make the competition more exciting, the Organizing Committee decides to change the competition system to the elimination competition.

The rules of the elimination competition are as follows: Suppose there are 2n2^n contestants, arranged in the order from 11 to 2n2^n, and the relative position of the contestants will not change during the competition. There are a total of nn rounds in the competition. At the first round, contestants numbered 2i12i-1 and contestants numbered 2i2i will solve a problem by programming within a limited time. The contestants who pass with less time will be promoted. The contestants who do not advance will be eliminated directly, and there will be no tie. At the second round, two contestants numbered from 4i34i-3 to 4i4i who won the last round will continue to compete under the same rules... At the jj-th round, two contestants numbered from (i1)2j+1(i-1)2^j+1 to i2ji2^j will compete until there is only one contestant left, who is the champion of the whole competition and will win the prize of unique sleeping black tea!

Now, the committee has entrusted Bob with the task of arranging the number of contestants. However, Bob is busy eating snow, so he gives this tough task to you and explains the conditions of the contestants. First of all, to ensure that the competition can continue, the number of participants must be 2n2^n; secondly, each contestant will have an ability value between 11 and 2n2^n. And the ability values between any two contestants are different. All the contestants can solve all the questions. The faster the contestants with higher ability value can solve the questions. For example, the contestants with the ability value of 22 and the ability value of 33 have both worked out a question, but the contestant with the ability value of 33 can work faster, so the contestant with the ability value of 33 is promoted, and the contestant with the ability value of 22 is eliminated.

But Bob has a good friend. He hopes you can plan a way to arrange the number of contestants so that this friend can promote as many times as possible.

Input

The first line contains two integers n,mn,m (0n<63,1m2×1050\leq n< 63,1\leq m\leq 2\times 10^5), representing the number of contestants is 2n2^n and the number of inquiries.

For the next mm lines, each line contains an integer xix_i (1xi2n1\leq x_i\leq 2^n), indicating that Bob wants the contestant whose capability value is xix_i to be promoted as many times as possible. All queries are independent with each other, which means that you can rearrange the number of contestants for each query, and you only need to ensure that in the current query the contestant whose capability value is xix_i be promoted as many times as possible without considering other contestants.

Output

A total of mm lines, for each line with an integer yiy_i, which means the contestant whose capability value is xix_i can be promoted at most yiy_i times. You do not need to output the concrete arrangement.

Samples

3 3
1
5
8
0
2
3

Note

For question 11, no matter how to arrange the number, the contestant with the ability value of 11 must be eliminated in the first round, so the number of promotions is 00;

For question 22, one arrangement is 6,8,7,3,2,4,5,16, 8, 7, 3, 2, 4, 5, 1. The flow chart of the competition can be made as follows:

Therefore, the promotion times are 22;

For question 33, no matter how to arrange the number, the contestant with the ability value of 88 must be the champion of this competition. The number of promotions is 33, and this person will win the prize of unique sleeping black tea.

Resources

电子科技大学第十三届 ACM 趣味程序设计竞赛