#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long test;
  cin >> test;
  while (test--) {
    long long n, k;
    cin >> n >> k;
    long long x = 1;
    vector<long long> a(n);
    vector<long long> ans(n);
    for (long long i = 0; i < n; i++) cin >> a[i];
    for (long long i = 0; i < n; i++) {
      if (a[i] * 2 < k)
        ans[i] = 1;
      else if (a[i] * 2 > k)
        ans[i] = 0;
      else {
        ans[i] = x;
        x ^= 1;
      }
    }
    for (long long i = 0; i < n; i++) {
      cout << ans[i] << " ";
    }
    cout << endl;
  }
}
