#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, k;
    cin >> n >> k;
    vector<long long int> a(n);
    for (long long int i = 0; i < n; i++) cin >> a[i];
    vector<long long int> b = a;
    sort(begin(b), end(b));
    long long int i = 0, j = 0;
    for (i = 0; i < n - 1; i++) {
      if (b[i] + b[i + 1] >= k) {
        j = i + 1;
        break;
      }
    }
    if (j == 0) {
      for (long long int x = 0; x < n; x++) cout << 1 << " ";
    } else if (b[i] == b[j]) {
      long long int q = b[i];
      long long int c = 0;
      for (long long int x = 0; x < n; x++) {
        if (a[x] < q)
          cout << 0 << " ";
        else if (a[x] > q)
          cout << 1 << " ";
        else if (a[x] == q && c == 0) {
          cout << 1 << " ";
          c = 1;
        } else if (a[x] == q && c == 1) {
          cout << 0 << " ";
          c = 0;
        }
      }
    } else {
      for (long long int x = 0; x < n; x++) {
        if (a[x] <= b[i])
          cout << 0 << " ";
        else if (a[x] >= b[j])
          cout << 1 << " ";
      }
    }
    cout << "\n";
  }
  return 0;
}
