#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, pre = 1;
  scanf("%lld %lld", &n, &t);
  long long ar[n], res[n];
  for (int i = 0; i < n; i++) scanf("%lld", &ar[i]);
  for (int i = 0; i < n; i++) {
    if (t % 2) {
      if (ar[i] > t / 2)
        res[i] = 1;
      else
        res[i] = 0;
    } else {
      if (ar[i] == t / 2) {
        res[i] = 1 - pre;
        pre = res[i];
      } else if (ar[i] < t / 2)
        res[i] = 0;
      else
        res[i] = 1;
    }
  }
  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;
}
