#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> v(n);
  vector<long long> ans(n, 0);
  long long cnt = 0;
  for (long long i = 0; i < (n); ++i) {
    cin >> v[i];
    ans[i] = v[i];
    if (v[i] + v[i] == k) cnt++;
  }
  sort(v.begin(), v.end());
  map<long long, long long> color;
  map<long long, long long> m;
  for (long long i = 0; i < (n); ++i) {
    if (v[i] > k) continue;
    if (m[k - v[i]]) {
      color[v[i]] = 1;
    }
    m[v[i]]++;
  }
  cnt /= 2;
  for (auto i : ans) {
    if (i + i == k && cnt) {
      cout << 0 << " ";
      cnt--;
      continue;
    }
    if (color[i])
      cout << 1 << " ";
    else
      cout << 0 << " ";
  }
  cout << "\n";
}
signed main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
