#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t-- > 0) {
    int n, k;
    cin >> n;
    cin >> k;
    int i, j, f = 0, a[n];
    for (i = 0; i < n; i++) cin >> a[i];
    for (i = 0; i < n; i++) {
      if (2 * a[i] == k) {
        if (f % 2 == 0) {
          cout << "0 ";
          f = 1;
        } else {
          cout << "1 ";
          f = 0;
        }
      } else {
        if (a[i] <= k / 2) {
          cout << "0 ";
        } else if (a[i] > k / 2) {
          cout << "1 ";
        }
      }
    }
  }
  return 0;
}
