#include <bits/stdc++.h>
using namespace std;
int main() {
  int k;
  cin >> k;
  for (int o = 0; o < k; o++) {
    int a[100005];
    int n, t;
    int color[100005];
    bool b = true;
    cin >> n >> t;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
      if (t % 2 == 0) {
        if (a[i] > (t / 2)) {
          color[i] = 0;
        } else if (a[i] < (t / 2))
          color[i] = 1;
        else {
          if (b)
            color[i] = 1;
          else
            color[i] = 0;
          b = !b;
        }
      } else {
        if (a[i] > (t / 2)) {
          color[i] = 0;
        } else
          color[i] = 1;
      }
    }
    for (int i = 0; i < n; i++) {
      cout << color[i] << " ";
    }
    cout << endl;
  }
}
