#include <bits/stdc++.h>
using namespace std;
const int tINF = (int)INT_MAX;
const long long lINF = (long long)LLONG_MAX;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    long long T;
    cin >> n >> T;
    vector<long long> ar(n);
    for (auto &i : ar) cin >> i;
    map<long long, int> mp;
    vector<long long> a1(n);
    for (int i = 0; i < n; ++i) {
      if (ar[i] > T) continue;
      if (mp[ar[i]] == 0) {
        a1[i] = 0;
        mp[T - ar[i]] = 1;
      } else {
        mp[T - ar[i]] = 0;
        a1[i] = 1;
      }
    }
    for (auto i : a1) cout << i << " ";
    cout << '\n';
  }
  if (false)
    cerr << "Time execute: " << (double)clock() / (double)CLOCKS_PER_SEC
         << " sec" << endl;
}
