#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  long long int t;
  cin >> n >> t;
  long long int x;
  int r;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (2 * x < t) {
      r = 0;
    } else if (2 * x > t) {
      r = 1;
    } else if (x == t / 2 && t % 2 == 0) {
      cnt++;
      r = cnt % 2;
    }
    cout << r << " ";
  }
  cout << endl;
}
int main(int argc, char const *argv[]) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
