You are given an array consisting of non-negative integers and queries. Each query is characterized by one number and consists of the following consecutive steps:
Perform the bitwise addition operation modulo (xor) of each array element with the number ;
Find the mex of the resulting array.
Note that after each query the array changes.
The first line contains two positive integers and (1 \le n, m \le 3 \cdot 10^5) — the number of elements in the array and the number of queries.
The next line contains non-negative integer numbers a_i (0 \le a_i \le 3 \cdot 10^5) — the elements of the array.
Each of the next lines contains a query — one non-negative integer number (0 \le x \le 3 \cdot 10^5).
For each query, print the answer on a separate line.
Example 1
Example 2
Example 3
Mex of a sequence of numbers is the minimum non-negative number that is not present in the sequence as an element. For example, mex([4, 33, 0, 1, 1, 5]) = 2 and mex([1, 2, 3]) = 0.