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