#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  vector<vector<int>> ans;
  for (int i = 0; i < t; i++) {
    int n, T;
    cin >> n >> T;
    int a[n];
    int colors[n];
    int half = T / 2;
    for (int j = 0; j < n; j++) {
      cin >> a[j];
    }
    if (T % 2 == 0) {
      vector<int> split;
      for (int j = 0; j < n; j++) {
        if (a[j] > T / 2)
          colors[j] = 0;
        else if (a[j] < T / 2)
          colors[j] = 1;
        else
          split.push_back(j);
      }
      for (int j = 0; j < (split.size()) / 2; j++) {
        colors[split[j]] = 0;
      }
      for (int j = (split.size()) / 2; j < split.size(); j++) {
        colors[split[j]] = 1;
      }
    } else {
      for (int j = 0; j < n; j++) {
        if (a[j] > T / 2)
          colors[j] = 0;
        else
          colors[j] = 1;
      }
    }
    for (int c : colors) {
      cout << c << ' ';
    }
    cout << '\n';
  }
}
