#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int N = 1e5 + 5, M = N;
void solve() {
  long long n, m, t;
  scanf("%lld %lld", &n, &t);
  long long ar[n], res[n];
  map<long long, long long> cnt;
  map<long long, long long> color;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &ar[i]);
    cnt[ar[i]]++;
    color[ar[i]] = 1;
  }
  for (int i = 0; i < n; i++) {
    long long u = ar[i], v = t - ar[i];
    if (cnt[u] > 0 && cnt[v] > 0) {
      if (u == v && cnt[u] > 1) {
        cnt[u]--;
        res[i] = color[u];
        if (color[u] == 1)
          color[u] = 0;
        else
          color[u] = 1;
      } else
        res[i] = color[u], cnt[u] = 0;
      if (u != v) {
        cnt[u]--;
        res[i] = color[u];
        cnt[v]--;
        if (color[u] == 1)
          color[v] = 0;
        else
          color[u] = 1;
      }
    } else
      res[i] = color[u];
  }
  for (int i = 0; i < n; i++) printf("%lld ", res[i]);
  printf("\n");
}
int main() {
  int t = 1;
  scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}
