#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    bool flag = true;
    long T;
    cin >> n >> T;
    long a[n];
    vector<int> ans;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      if (a[i] < float(T) / 2.0)
        ans.push_back(1);
      else if (a[i] > float(T) / 2.0)
        ans.push_back(0);
      else {
        if (flag)
          ans.push_back(0);
        else
          ans.push_back(1);
        flag = !(flag);
      }
    }
    for (long i : ans) cout << i << ' ';
    cout << endl;
  }
}
