#include <bits/stdc++.h>
using namespace std;
const int N = 505;
long long MOD = 1e9 + 7;
long long INF = -1e9;
void solve() {
  int n;
  long long t;
  cin >> n >> t;
  int cur = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    if ((2 * x) == t) {
      cout << cur << " ";
      cur = 1 - cur;
    }
    if ((2 * x) < t) {
      cout << 0 << " ";
    }
    if ((2 * x) > t) {
      cout << 1 << " ";
    }
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
