#include <bits/stdc++.h>
using namespace std;
using ii = pair<int, int>;
using ll = long long;
constexpr int MAXN = 5 + 1e5;
int res[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int tc;
  cin >> tc;
  while (tc--) {
    int n, t;
    cin >> n >> t;
    set<int> s;
    vector<int> rem;
    for (int i = 0; i < n; ++i) {
      int x;
      cin >> x;
      if (x + x == t) {
        rem.push_back(i);
        continue;
      }
      if (s.find(x) == s.end()) {
        res[i] = 1;
        s.insert(t - x);
      } else {
        res[i] = 0;
      }
    }
    int h = ((int)rem.size()) / 2;
    for (int i = 0; i < h; ++i) res[rem[i]] = 1;
    for (int i = h; i < (int)rem.size(); ++i) res[rem[i]] = 0;
    for (int i = 0; i < n; ++i) {
      cout << res[i] << ' ';
    }
    cout << '\n';
  }
  return 0;
}
