#include <bits/stdc++.h>
using namespace std;
pair<int, int> a[100003];
int m[100003];
int main() {
  int t, n, T;
  cin >> t;
  while (t--) {
    cin >> n >> T;
    int in1 = 0, in2 = n - 1;
    fill(m, m + n, -1);
    for (int i = 0; i < n; ++i) {
      cin >> a[i].first;
      a[i].second = i;
    }
    sort(a, a + n);
    while (in1 <= in2) {
      if (m[a[in1].second] != -1) {
        ++in1;
        continue;
      }
      if (m[a[in2].second] != -1) {
        --in2;
        continue;
      }
      int sum = a[in1].first + a[in2].first;
      if (sum == T) {
        m[a[in1].second] = 0, m[a[in2].second] = 1;
        ++in1;
        --in2;
      } else if (sum < T) {
        m[a[in1].second] = 0;
        ++in1;
      } else {
        m[a[in2].second] = 1;
        --in2;
      }
    }
    for (int i = 0; i < n; ++i) {
      cout << m[i] << ' ';
    }
    cout << '\n';
  }
}
