You have an array of integers A1, A2, ..., AN. The function F(P), where P is a subset of A, is defined as the XOR (represented by the symbol ⊕) of all the integers present in the subset. If P is empty, then F(P)
Given an integer K, what is the maximum value of K ⊕ F(P), over all possible subsets P of A?

Input
The first line contains T, the number of test cases. Each test case consists of N and K in one line, followed by the array A in the next line.

Output
For each test case, print the required answer in one line.

Constraints

1 ≤ T ≤ 10
1 ≤ K, Ai ≤ 1000
Example
Input:
1
3 4
1 2 3

Output:
7


Explanation
Considering all subsets: F({}) = 0 ⇒ 4 ⊕ 0 = 4 F({1}) = 1 ⇒ 4 ⊕ 1 = 5 F({1,2}) = 3 ⇒ 4 ⊕ 3 = 7 F({1,3}) = 2 ⇒ 4 ⊕ 2 = 6 F({1,2,3}) = 0 ⇒ 4 ⊕ 0 = 4 F({2}) = 2 ⇒ 4 ⊕ 2 = 6 F({2,3}) = 1 ⇒ 4 ⊕ 1 = 5 F({3}) = 3 ⇒ 4 ⊕ 3 = 7 Therefore, the answer is 7.
def least_bit_set(x):
    return x & (-x)

def eliminate(values):
    values = list(values)
    i = 0
    while True:
        values = [v for v in values if v > 0]
        if i >= len(values):
            return values
        j = i
        for k in range(i + 1, len(values)):
            if least_bit_set(values[k]) < least_bit_set(values[j]):
                j = k
        values[i], values[j] = (values[j], values[i])
        for k in range(i + 1, len(values)):
            if least_bit_set(values[k]) == least_bit_set(values[i]):
                values[k] ^= values[i]
        i += 1
    return values

def in_span(x, eliminated_values):
    for y in eliminated_values:
        if least_bit_set(y) & x != 0:
            x ^= y
    return x == 0

for _ in xrange(int(raw_input())):
  n, k = map(int, raw_input().split())
  values = map(int, raw_input().split())
  eliminated_values = eliminate(values)
  res = k
  for target in xrange(1023, 0, -1):
    if in_span(target ^ k, eliminated_values):
      res = target
      break
  print res