#include<bits/stdc++.h>
using namespace std;

using ui=unsigned int;
using ll=long long;
using ull=unsigned long long;
using i128=__int128_t;
using u128=__uint128_t;
using ld=long double;

void solve()
{//简单的模拟 甚至把公式给你了 按题目所述编写代码即可
    int n,q,l,r;
	cin >> n >> q;
	vector<ll>v(n+1,0);
	for(int i=1;i<=n;i++) cin >> v[i];
	cin >> l >> r;
	ll temp=v[1];
	for(int i=2;i<=n;i++)
	{
		temp=temp+v[i]-(temp^v[i]);
	}
	cout << temp << "\n";
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int t=1;
	cin >> t;

	while(t--)
	{
		solve();
	}
	return 0;
}