//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")
#include <bits/stdc++.h>
#define ll long long
#define int long long
#define all(v) v.begin(), v.end()
#define nl '\n'
#define pb push_back
#define sz(s) (int)(s).size()
#define f first
#define s second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const ll N = 2e5+10, MX = 1e18+1, MOD = 1e9 + 7;
void solve(){
    ll n, k;
    cin >> n >> k;
    ll a[n + 1];
    for(int i = 1; i <= n; i++){
       cin >> a[i]; 
    }
    ll p = 1;
    while(p <= k){
        ll sum = 0;
        for(int i = 1; i <= n; i++){
            sum += a[i]/p;
        }
        if(sum % 2 == 1){
            cout << 1;
            return;
        }
        p*=2;
    }
    cout << 0;
}
main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    ll ql =1;
    cin >> ql;
	 while(ql--){
	    solve();
	}
}
Compilation message (stderr)
football.cpp:38:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   38 | main(){
      | ^~~~| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |