#include <bits/stdc++.h>
using namespace std;
long long n, v[100005], b[100005];
map<int, int> mymap;
map<int, int> w;
int main() {
  long long i, t, k, T, j;
  cin >> t;
  while (t--) {
    cin >> n >> T;
    long long k1 = 0, k2 = 0, nrop = 0;
    for (i = 1; i <= n; i++) {
      cin >> v[i];
      w[v[i]] = 1;
      mymap[v[i]]++;
    }
    for (i = 1; i <= n; i++) {
      if (mymap[T - v[i]] != 0) {
        if (w[v[i]] == w[T - v[i]]) {
          if (w[v[i]] == 1) w[T - v[i]] = 2;
        }
      }
    }
    long long ans = 0;
    for (i = 1; i <= n; i++) {
      if (v[i] * 2 == T) {
        if (ans % 2 == 0) {
          cout << 0 << " ";
          ans++;
        } else {
          cout << 1 << " ";
          ans++;
        }
      } else
        cout << w[v[i]] - 1 << " ";
    }
    cout << '\n';
  }
  return 0;
}
