#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
void solving() {
  long long int n, T;
  cin >> n >> T;
  vector<long long int> v(n), ans, av, bv;
  unordered_set<long long int> a, b;
  unordered_map<long long int, long long int> mpa, mpb;
  for (auto &i : v) {
    cin >> i;
  }
  for (long long int i = 0; i < n; i++) {
    if (a.find(T - v[i]) == a.end()) {
      a.insert(v[i]);
      av.push_back(v[i]);
      mpa[v[i]]++;
      cout << 0 << " ";
    } else if (b.find(T - v[i]) == b.end()) {
      b.insert(v[i]);
      bv.push_back(v[i]);
      mpb[v[i]]++;
      cout << 1 << " ";
    } else {
      if (mpa[T - v[i]] <= mpb[T - v[i]]) {
        av.push_back(v[i]);
        mpa[v[i]]++;
        cout << 0 << " ";
      } else {
        bv.push_back(v[i]);
        mpb[v[i]]++;
        cout << 1 << " ";
      }
    }
  }
  cout << "\n";
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t{};
  cin >> t;
  while (t--) solving();
  return 0;
}
