#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  cin >> t;
  while (t--) {
    long long n, k;
    long long c = 0;
    cin >> n >> k;
    vector<long long> v(n);
    for (int i = 0; i < n; ++i) {
      cin >> v[i];
      if (2 * v[i] > k)
        cout << 1 << " ";
      else if (2 * v[i] < k)
        cout << 0 << " ";
      else {
        if (c & 1)
          cout << 0 << " ";
        else
          cout << 1 << " ";
        c++;
      }
    }
    cout << "\n";
  }
  return 0;
}
