#include <bits/stdc++.h>
using namespace std;
struct prefix_array {
  int size, xored;
  vector<int> a;
  prefix_array(int max_element) : size(max_element), xored(0) {
    while (size & (size - 1)) size &= size - 1;
    if (max_element != size) size *= 2;
    a.assign(size + 1, 0);
  }
  void add(int x) { a[x + 1] = 1; }
  void recalc() {
    for (int i = 1; i <= size; i++) a[i] += a[i - 1];
  }
  int get(int l, int r) { return a[r] - a[l]; }
  int get_mex() {
    int l = 0, r = size;
    int current_bit = r / 2;
    while (current_bit != 0) {
      if (xored & current_bit) {
        if (get(l + current_bit, r) != current_bit) {
          l = l + current_bit;
        } else {
          r = l + current_bit;
        }
      } else {
        if (get(l, l + current_bit) != current_bit) {
          r = l + current_bit;
        } else {
          l = l + current_bit;
        }
      }
      current_bit /= 2;
    }
    return l ^ xored;
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  prefix_array pa(3 * 100 * 1000);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    pa.add(tmp);
  }
  pa.recalc();
  for (int i = 0; i < m; i++) {
    int tmp;
    cin >> tmp;
    pa.xored ^= tmp;
    cout << pa.get_mex() << '\n';
  }
  return 0;
}
