#include <bits/stdc++.h>
using namespace std;
const int MAX = 1000 * 1000 + 10;
int tt, n, k, t[MAX], kurde;
bool wyn[MAX];
map<int, int> jed, dwa;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> tt;
  while (tt--) {
    cin >> n >> k;
    kurde = 0;
    for (int i = 1; i <= n; i++) {
      cin >> t[i];
      if (k % 2 == 0 && t[i] == k / 2) kurde++;
    }
    for (int i = 1; i <= n; i++) {
      if (kurde && t[i] == k / 2) {
        if (jed[k / 2] < (kurde + 1) / 2)
          jed[k / 2]++, wyn[i] = 0;
        else
          dwa[k / 2]++, wyn[i] = 1;
      } else if (jed[k - t[i]])
        dwa[t[i]]++, wyn[i] = 1;
      else
        jed[t[i]]++, wyn[i] = 0;
      ;
    }
    jed.clear(), dwa.clear();
    for (int i = 1; i <= n; i++) cout << wyn[i] << " ";
    cout << "\n";
  }
}
