#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n, un;
    cin >> n >> un;
    vector<long long> a(n);
    for (long long i = 0; i < n; i++) cin >> a[i];
    vector<long long> ans(n);
    long long sama = 0;
    for (long long i = 0; i < n; i++) {
      if (2 * a[i] < un)
        ans[i] = 0;
      else if (2 * a[i] == un) {
        ans[i] = sama;
        sama = 1 - sama;
      } else
        ans[i] = 1;
    }
    for (long long i = 0; i < n; i++) cout << ans[i] << " ";
    cout << '\n';
  }
}
