#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, T;
  cin >> n >> T;
  int a[n], cnt = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    cnt += (a[i] == T / 2);
  }
  for (int i = 0, j = 1; i < n; i++) {
    if ((float)a[i] < (float)T / 2)
      cout << 0 << " ";
    else if ((float)a[i] > (float)T / 2)
      cout << 1 << " ";
    else {
      if (j <= cnt / 2) {
        cout << 0 << " ";
        j++;
      } else
        cout << 1 << " ";
    }
  }
  cout << "\n";
  return;
}
int main() {
  std::ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
