#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    vector<long long> vect;
    for (long long i = 0; i < n; i++) {
      long long a;
      cin >> a;
      vect.push_back(a);
    }
    vector<long long> ans(n, 0);
    vector<long long> white;
    vector<long long> black;
    map<long long, vector<long long>> mapp;
    for (long long i = 0; i < n; i++) {
      mapp[vect[i]].push_back(i);
    }
    for (long long i = 0; i < n; i++) {
      long long ele = vect[i];
      long long diff = k - ele;
      if (mapp.count(diff) && mapp.count(ele)) {
        if (diff == ele) {
          if (mapp[diff].size() > 1) {
            vector<long long> temp = mapp[diff];
            for (long long j = 0; j < temp.size() / 2; j++) {
              black.push_back(temp[j]);
            }
            mapp.erase(diff);
          }
        } else {
          vector<long long> temp = mapp[diff];
          for (long long j = 0; j < temp.size(); j++) {
            black.push_back(temp[j]);
          }
          mapp.erase(diff);
        }
      }
    }
    for (long long i = 0; i < black.size(); i++) {
      ans[black[i]] = 1;
    }
    for (long long i = 0; i < ans.size(); i++) {
      cout << ans[i] << " ";
    }
    cout << endl;
  }
}
