#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  register long long ret = 0, f = 1;
  register char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    ret = (ret << 1) + (ret << 3) + (c ^ 48);
    c = getchar();
  }
  return ret * f;
}
long long n, tot, b[100005];
long long sum, l[100005], now;
map<long long, bool> mp;
signed main() {
  register long long T = read();
  while (T--) {
    n = read();
    sum = read();
    tot = 0;
    now = 1;
    for (register long long i = 1; i <= n; i++) b[i] = read();
    for (register long long i = 1; i <= n; i++) {
      if (b[i] > sum)
        l[i] = 1;
      else if (b[i] * 2 == sum)
        l[i] = now, now ^= 1;
      else if (!mp[sum - b[i]]) {
        mp[b[i]] = 1;
        l[i] = 1;
      } else
        l[i] = 0;
    }
    for (register long long i = 1; i <= n; i++)
      mp[b[i]] = 0, printf("%lld ", l[i]);
    if (T) puts("");
  }
  return 0;
}
