#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k, r, c = 0;
    cin >> n >> k;
    int a[n];
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      if (k % 2 == 0 && a[i] == k / 2)
        r = (c++) % 2;
      else if (a[i] > k / 2)
        r = 1;
      else
        r = 0;
      cout << r << " ";
    }
    cout << endl;
  }
  return 0;
}
