#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const double eps = 1e-9;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int maxn = 6e6 + 10;
const int MAX = 1e5;
const double pi = acos(-1.0);
const long long INF = 0x3f3f3f3f3f3f3f;
long long qpow(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res % mod;
}
long long T = 1;
long long m, n;
int main() {
  T = read();
  while (T--) {
    double t;
    double x;
    int d = 0;
    cin >> n >> t;
    for (int i = 0; i < n; i++) {
      cin >> x;
      if (x < t / 2.0)
        cout << 1 << ' ';
      else if (x == t / 2.0) {
        cout << d << ' ';
        d ^= 1;
      } else
        cout << 0 << ' ';
    }
    cout << '\n';
  }
  return 0;
}
