#include <bits/stdc++.h>
#pragma GCC optimize("O3")
const int N = 5e3 + 5;
const int OO = 1e16;
const long long mood = 1e9 + 7;
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int q;
  cin >> q;
  while (q--) {
    double t;
    long long n, x, ok = 0;
    cin >> n >> t;
    t /= 2.0;
    for (int i = 0; i < n; i++) {
      cin >> x;
      if (x > t)
        cout << "1 ";
      else if (x < t)
        cout << "0 ";
      else if (t == x) {
        cout << ok << " ";
        ok ^= 1;
      }
    }
    cout << '\n';
  }
  return 0;
}
