#include <bits/stdc++.h>
using namespace std;
template <class A, class B>
ostream& operator<<(ostream& out, const pair<A, B>& a) {
  return out << "(" << a.first << ", " << a.second << ")";
}
template <class A>
ostream& operator<<(ostream& out, const vector<A>& v) {
  out << "[";
  for (int i = 0; i < v.size(); i++) {
    if (i) out << ", ";
    out << v[i];
  }
  return out << "]";
}
void solve() {
  int n, T;
  cin >> n >> T;
  vector<int> a(n);
  int c = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (2 * a[i] == T) c++;
  }
  c /= 2;
  for (int i = 0; i < n; i++) {
    if (a[i] > T)
      cout << 0 << ' ';
    else if (2 * a[i] == T) {
      if (c) {
        cout << 0 << ' ';
        c--;
      } else
        cout << 1 << ' ';
    } else {
      if (2 * a[i] < T)
        cout << 0 << ' ';
      else
        cout << 1 << ' ';
    }
  }
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int q = 1;
  cin >> q;
  for (int kase = 1; kase <= q; kase++) {
    solve();
  }
  return 0;
}
