Alfred and Magic Box

0

0 votes
Easy-Medium
Problem

Alfred has found a magic box in Wayne Enterprises . He notices that whenever he drops a number in this box, a new number is generated which appear above the box. While leaving 4 years ago, Bruce told him that the mysterious box gives the maximum of xor of dropped number with all the numbers present in the box.

Help Alfred find the newly generated number.

Input

The first line contains two space separated integers, N denoting total number of integers already present in the box and T denoting the total number of integers to be dropped in the box.

Second line contains N integers initially present in the box.

Next T lines contain single integer X denoting the dropped number.

Output

For each dropped number, output a single number each in separate line denoting the number which is generated by the box.

Constraints

1N105

1T105

0ai109

0X109

Time Limit: 0.5
Memory Limit: 256
Source Limit:
Editor Image

?