#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
const long long INF = LLONG_MAX / 2;
const long long N = 2e5 + 1;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n, first;
    cin >> n >> first;
    vector<pair<long long, long long> > a(n);
    for (long long i = 0; i < n; i++) cin >> a[i].first;
    if (first % 2)
      for (long long i = 0; i < n; i++) {
        if (a[i].first <= first / 2) a[i].second = 1;
      }
    else {
      long long c = 0, r = 0;
      for (long long i = 0; i < n; i++)
        if (a[i].first == first / 2) c++;
      for (long long i = 0; i < n; i++)
        if (a[i].first < first / 2)
          a[i].second = 1;
        else if (a[i].first == first / 2 && r < c / 2)
          a[i].second = 1, r++;
    }
    for (long long i = 0; i < n; i++) cout << a[i].second << " ";
    cout << '\n';
  }
  return 0;
}
