#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, t;
  cin >> t;
  for (i = 0; i < t; i++) {
    int n, T;
    cin >> n >> T;
    int a[n + 1];
    for (int j = 1; j <= n; j++) cin >> a[j];
    map<int, int> np_c, np_d;
    for (int j = 1; j <= n; j++) {
      int el = a[j];
      if (np_c[T - el] <= np_d[T - el])
        np_c[el]++;
      else
        np_d[el]++;
    }
    int ans[n + 1];
    for (int j = 1; j <= n; j++) {
      int el = a[j];
      if (np_c[el] > 0) {
        ans[j] = 0;
        np_c[el]--;
      } else {
        ans[j] = 1;
        np_d[el]--;
      }
    }
    for (int j = 1; j <= n; j++) cout << ans[j] << " ";
    cout << endl;
  }
  return 0;
}
