#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, T;
    cin >> n >> T;
    vector<int> a(n);
    for (int& x : a) {
      cin >> x;
    }
    unordered_map<int, int> mp;
    unordered_map<int, int> mp1;
    for (int i = 0; i < n; i++) {
      if (2 * a[i] == T) {
        cout << mp1[a[i]] << " ";
        mp1[a[i]] ^= 1;
      } else {
        if (mp[a[i]] == 0) {
          mp[a[i]] = 1, mp[T - a[i]] = 1;
          mp1[T - a[i]] = 1;
          mp1[a[i]] = 0;
        }
        cout << mp1[a[i]] << " ";
      }
    }
    cout << endl;
  }
}
