#include <bits/stdc++.h>
using namespace std;
const int inf = int(1e9 + 7);
const int maxn = 1e5 + 228;
const double PI = 3.141592653589793238462643;
void solve() {
  int n, t;
  cin >> n >> t;
  map<int, int> ma;
  int a[n];
  int hf = -1;
  if (t % 2 == 0) hf = t / 2;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] == hf) sum++;
    if (a[i] > t)
      ma[a[i]] = 1;
    else {
      if (ma[a[i]] != 0)
        ma[t - a[i]] = 0;
      else
        ma[t - a[i]] = 1;
    }
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == hf) {
      if (sum % 2)
        cout << 1 << ' ';
      else
        cout << 0 << ' ';
      sum--;
    } else
      cout << ma[a[i]] << ' ';
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
