t = int(input())
for _ in range(t):
n, q = map(int,input().split())
a = list(map(int,input().split()))
lr = [list(map(int,input().split())) for _ in range(q)]
if n>61:
print(0)
continue
cur_val = a[0]
for i in range(1,n):
cur_val = (cur_val & a[i])<<1
print(cur_val)



京公网安备 11010502036488号