#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long q;
  cin >> q;
  while (q--) {
    long long n, t;
    cin >> n >> t;
    long long a[n];
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
    }
    long long ans[n];
    for (long long i = 0; i < n; i++) ans[i] = 0;
    for (long long i = 0; i < n; i++) {
      if (a[i] <= t / 2)
        ans[i] = 0;
      else
        ans[i] = 1;
    }
    if (t % 2 == 0) {
      long long cnt = 0;
      for (long long i = 0; i < n; i++) {
        if (a[i] == t / 2) {
          cnt++;
        }
      }
      cnt /= 2;
      for (long long i = 0; i < n; i++) {
        if (a[i] == t / 2 and cnt > 0) {
          ans[i] = 1;
          cnt--;
        }
      }
    }
    for (long long i = 0; i < n; i++) cout << ans[i] << ' ';
    cout << "\n";
  }
}
