#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  while (a--) {
    int n, k;
    cin >> n >> k;
    int arr[n], sum = 0;
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
    }
    int p;
    if (k % 2 != 0) {
      p = k / 2;
      for (int j = 0; j < n; j++) {
        if (arr[j] <= p)
          arr[j] = 0;
        else
          arr[j] = 1;
      }
    } else {
      p = k / 2;
      int q = 0;
      for (int s = 0; s < n; s++) {
        if (arr[s] == p) {
          q += 1;
        }
      }
      int d = 0;
      for (int c = 0; c < n; c++) {
        if (arr[c] <= p) {
          if (arr[c] == p) {
            if (d < q / 2) {
              arr[c] = 0;
              d += 1;
            } else
              arr[c] = 1;
          } else
            arr[c] = 0;
        } else
          arr[c] = 1;
      }
    }
    for (int u = 0; u < n; u++) cout << arr[u] << " ";
  }
}
