Problem: This is the easy version of the problem. The only difference between the two versions is the constraint on and , the memory and time limits. You can make hacks only if all versions of the problem are solved.
Theofanis really likes to play with the bits of numbers. He has an array of size and an integer . He can make at most operations in the array. In each operation, he picks a single element and increases it by .
He found the maximum bitwise AND that array can have after at most operations.
Theofanis has put a lot of work into finding this value and was very happy with his result. Unfortunately, Adaś, being the evil person that he is, decided to bully him by repeatedly changing the value of .
Help Theofanis by calculating the maximum possible bitwise AND for different values of . Note that queries are independent.
Input Format: The first line contains two integers and ( and ) — the size of the array and the number of queries.
The second line contains integers () — the elements of the array.
Next lines describe the queries. The -th line contains one integer () — the number of operations that can be done in the -th query.
Output Format: For each query, print one integer — the maximum bitwise AND that array can have after at most operations.
Note: In the first test case, in the first query, we add in the first and last elements of the array.
Thus, the array becomes with bitwise AND equal to .
In the second test case, in the first query, we add in the first element, in the second, and in the third and now all the elements are equal to .