#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);
  }
  for (auto it = st.begin(); it != st.end(); it++) {
    long long toSearch = t - *it;
    if (cnt.find(toSearch) != cnt.end()) {
      long long times = min(cnt[*it], cnt[toSearch]), count = 0;
      if (*it == toSearch) times = cnt[*it] / 2;
      while (times > count) {
        count++;
        ans[mpIn[*it].back()] = 0;
        mpIn[*it].pop_back();
        mpIn[toSearch].pop_back();
        cnt[*it]--;
        cnt[toSearch]--;
      }
      long long maxx = max(cnt[*it], cnt[toSearch]);
      count = 0;
      if (cnt[*it] != 0) {
        while (maxx > count) {
          count++;
          ans[mpIn[*it].back()] = 0;
          mpIn[*it].pop_back();
          cnt[*it]--;
        }
      } else {
        while (maxx > count) {
          count++;
          ans[mpIn[toSearch].back()] = 1;
          mpIn[toSearch].pop_back();
          cnt[toSearch]--;
        }
      }
    }
  }
  for (auto &it : ans) cout << it << " ";
  cout << endl;
  return;
}
