#include <bits/stdc++.h>
using namespace std;
int tc;
int main() {
  cin >> tc;
  int n, k;
  for (int t = 0; t < tc; t++) {
    cin >> n >> k;
    vector<int> arr, answer;
    arr.resize(n);
    answer.resize(n);
    for (int i = 0; i < n; i++) cin >> arr[i];
    int gijoon = k / 2, flg = 0;
    for (int i = 0; i < n; i++) {
      if (k % 2 == 0 && arr[i] == gijoon) {
        if (flg == 0) {
          answer[i] = 1;
          flg = 1;
        } else {
          answer[i] = 0;
          flg = 0;
        }
      } else if (arr[i] <= gijoon)
        answer[i] = 0;
      else
        answer[i] = 1;
    }
    for (int i = 0; i < n; i++) cout << answer[i] << " ";
    cout << endl;
  }
}
