#include <bits/stdc++.h>
long long pows(long long base, long long power, long long mod) {
  long long result = 1;
  while (power > 0) {
    if (power & 1) {
      result = result * base % mod;
    }
    power >>= 1;
    base = (base * base) % mod;
  }
  return result;
}
long long poww(long long base, long long power) {
  long long result = 1;
  while (power > 0) {
    if (power & 1) {
      result = result * base;
    }
    power >>= 1;
    base = (base * base);
  }
  return result;
}
const int inf = 1e17;
const int N = 1e5 + 10 + 10;
const int M = 1e9 + 10;
const long long mod = 1e9 + 7;
using namespace std;
long long t;
long long a[N], vis[N];
struct Node {
  long long v, id;
} e[N];
int cmp(Node a, Node b) { return a.v < b.v; }
int main() {
  scanf("%lld", &t);
  while (t--) {
    long long n, k;
    scanf("%lld %lld", &n, &k);
    long long ind = 0;
    for (long long i = 1; i <= n; i++) {
      vis[i] = 0;
      scanf("%lld", &e[i].v);
      e[i].id = i;
      if (e[i].v == (k / 2)) ind++;
    }
    sort(e + 1, e + 1 + n, cmp);
    for (long long i = 1; i <= n - 1; i++) {
      if (e[i].v + e[i + 1].v >= k) {
        if (e[i].v == e[i + 1].v) {
          break;
        } else {
          vis[e[i].id] = 1;
        }
        break;
      } else {
        vis[e[i].id] = 1;
      }
    }
    if (k % 2 == 0) {
      ind /= 2;
      for (long long i = 1; i <= n; i++) {
        if (ind > 0) {
          if (e[i].v == (k / 2)) {
            vis[e[i].id] = 1;
            ind--;
          }
        } else
          break;
      }
    }
    for (long long i = 1; i <= n; i++) {
      cout << vis[i] << " ";
    }
    cout << endl;
  }
  return 0;
}
