#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lli = long long int;
using ld = long double;
void solve() {
  ll n, T;
  cin >> n >> T;
  vector<ll> v(n);
  ll ans, cnt = 0;
  for (auto& x : v) {
    cin >> x;
    if (T % 2 == 0 && x == T / 2)
      ans = (cnt++) % 2;
    else if (2 * x < T)
      ans = 0;
    else
      ans = 1;
    cout << ans << " ";
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  ll test;
  cin >> test;
  while (test--) solve();
  return 0;
}
