#include <bits/stdc++.h>
using namespace std;
void fun() {
  int n, tar;
  cin >> n >> tar;
  int curMid = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    int r;
    if (tar % 2 == 0 && x == tar / 2)
      r = (curMid++) % 2;
    else if (2 * x < tar)
      r = 0;
    else
      r = 1;
    cout << r << " \n"[i == n - 1];
  }
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    fun();
    cout << endl;
  }
  return 0;
}
