Read problems statements in Mandarin Chinese  and Russian. 

You have an array of integers A_{1}, A_{2}, ..., A_{N}. 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)=0.

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, A_{i} ≤ 1000$
$Subtask 1 (30 points):1 ≤ N ≤ 20$
$Subtask 2 (70 points):1 ≤ N ≤ 1000$
 
----- Sample Input 1 ------ 
1
3 4
1 2 3
----- Sample Output 1 ------ 
7
----- explanation 1 ------ 

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.

Difficulty: MEDIUM_HARD

Solutions:
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	W = [int(x) for x in input().split()]
	S = {k}
	for i in W:
		_t = []
		for j in S:
			_t.append(i ^ j)
		for x in _t:
			S.add(x)
	print(max(S))


t = int(input())
while t > 0:
	t -= 1
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	ad = set(arr)
	w = set()
	w = []
	w.append(k)
	ans = k
	v = set()
	v.add(k)
	for i in ad:
		for j in range(len(w)):
			x = w[j] ^ i
			ans = max(ans, x)
			v.add(x)
		w = v
		w = list(w)
	print(ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = [int(i) for i in input().split()]
	ans = k
	s = {k}
	for i in l:
		temp = set()
		for j in s:
			curr = i ^ j
			ans = max(curr, ans)
			temp.add(curr)
		s = s | temp
	print(ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	a = set()
	a.add(k)
	for i in l:
		c = a.copy()
		for j in c:
			a.add(i ^ j)
	print(max(a))


test = int(input())
for _ in range(test):
	(n, k) = map(int, input().split())
	x = list(map(int, input().split()))
	z = {k}
	for i in x:
		t = []
		for k in z:
			t.append(i ^ k)
		for k in t:
			z.add(k)
	print(max(z))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = [*map(int, input().split())]
	s = set([0])
	for i in a:
		e = set(s)
		for x in s:
			e.add(x ^ i)
		s = e
	mx = k
	for i in s:
		mx = max(mx, i ^ k)
	print(mx)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ar = list(map(int, input().split()))
	ans = k
	s = {k}
	for i in ar:
		temp = set()
		for j in s:
			cur = i ^ j
			ans = max(ans, cur)
			temp.add(cur)
		s = s | temp
	print(ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	some = list(map(int, input().split()))
	some1 = set()
	some1.add(k)
	for i in some:
		some2 = set()
		for j in some1:
			some2.add(i ^ j)
		for j in some2:
			some1.add(j)
	print(max(some1))


def solve():
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	vis = set()
	vis.add(k)
	for i in arr:
		temp = set()
		for j in vis:
			temp.add(i ^ j)
		vis = vis.union(temp)
	print(max(vis))
for t in range(int(input())):
	solve()


for tc in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	a = set()
	a.add(k)
	for i in l:
		temp = a.copy()
		for j in temp:
			a.add(i ^ j)
	print(max(a))


for i in range(int(input())):
	(n, k) = [int(x) for x in input().split()]
	l = list(map(int, input().split()))
	s = {k}
	for i in l:
		a = []
		for j in s:
			a.append(j ^ i)
		for d in a:
			s.add(d)
	print(max(s))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	ad = set(arr)
	w = [k]
	ans = k
	v = set()
	v.add(k)
	for i in ad:
		for j in range(len(w)):
			x = w[j] ^ i
			ans = max(ans, x)
			v.add(x)
		w = list(v)
	print(ans)


t = int(input())
for it in range(t):
	(n, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = set()
	b.add(k)
	for i in a:
		c = b.copy()
		for j in c:
			b.add(i ^ j)
	print(max(b))


for u in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	s = set()
	s.add(k)
	for i in l:
		d = s.copy()
		for j in d:
			s.add(i ^ j)
	print(max(s))