#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t, i, j, n, k, c;
  cin >> t;
  while (t--) {
    cin >> n >> k;
    long long int a[n + 5], b[n + 5], cnt = 0;
    c = 0;
    for (i = 0; i < n; i++) {
      cin >> a[i];
      if (a[i] == k / 2) c++;
    }
    for (i = 0; i < n; i++) {
      if (a[i] > k / 2)
        b[i] = 1;
      else if (k % 2 == 0 && a[i] == k / 2 && cnt < c / 2) {
        b[i] = 1;
        cnt++;
      } else
        b[i] = 0;
    }
    for (i = 0; i < n; i++) cout << b[i] << " ";
    cout << '\n';
  }
  return 0;
}
