#include <bits/stdc++.h>
using namespace std;
void solve();
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long tc = 1;
  cin >> tc;
  while (tc--) {
    solve();
  }
  return 0;
}
void solve() {
  long long n, t, x;
  cin >> n >> t;
  vector<long long> ans(n, 1);
  map<long long, long long> cnt;
  map<long long, vector<long long>> mpIn;
  set<long long> st, doneWith;
  long long color = 1;
  for (long long i = 0; i < n; i++) {
    cin >> x;
    cnt[x]++;
    mpIn[x].push_back(i);
    st.insert(x);
    if (x > (t / 2))
      ans[i] = 0;
    else if (x < (t / 2))
      ans[i] = 1;
    if (t % 2 == 0 && x == (t / 2)) {
      ans[i] = color;
      color ^= 1;
    }
  }
  for (auto &it : ans) cout << it << " ";
  cout << endl;
  return;
}
