#include <bits/stdc++.h>
using namespace std;
const long long int mxn = 1e6;
void tc() {
  long long int n, T;
  cin >> n >> T;
  long long int cnt = T / 2;
  bool even = false;
  if (T % 2 == 0) {
    even = true;
  }
  long long int occ = 0;
  long long int arr[n];
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
    if (even and arr[i] == cnt) {
      occ++;
    }
  }
  long long int white = occ / 2;
  long long int black = occ - white;
  vector<long long int> ans(n);
  for (long long int i = 0; i < n; i++) {
    if (arr[i] < cnt) {
      ans[i] = 0;
    } else if (arr[i] > cnt) {
      ans[i] = 1;
    } else if (arr[i] == cnt and !even) {
      ans[i] = 0;
    } else if (arr[i] == cnt and even) {
      if (white > 0)
        ans[i] = 0, white--;
      else
        ans[i] = 1, black--;
    }
  }
  for (long long int i = 0; i < n; i++) cout << ans[i] << " ";
  cout << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  t = 1;
  cin >> t;
  while (t--) tc();
}
