#include <bits/stdc++.h>
using namespace std;
int t, n, T, a[100005], r[100005];
int main() {
  cin >> t;
  set<int> w, b;
  while (t--) {
    cin >> n >> T;
    for (int i = 0; i < n; i++) cin >> a[i];
    map<int, int> m;
    for (int i = 0; i < n; i++) {
      if (!m.count(a[i])) {
        r[i] = 0;
        m[T - a[i]] = 1;
      } else {
        r[i] = m[a[i]];
        m[T - a[i]] = !r[i];
      }
    }
    for (int i = 0; i < n; i++) cout << r[i] << " ";
    cout << "\n";
  }
  return 0;
}
