#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    vector<long long int> v(n);
    vector<int> vec(n);
    for (long long i = 0; i < n; i++) cin >> v[i];
    int tmp = 0;
    for (long long i = 0; i < n; i++) {
      long long int x = v[i];
      long long int y = k - v[i];
      if (x > y)
        vec[i] = 0;
      else if (x < y)
        vec[i] = 1;
      else if (x == y) {
        vec[i] = tmp;
        if (tmp == 0)
          tmp = 1;
        else
          tmp = 0;
      }
    }
    for (long long i = 0; i < n; i++) cout << vec[i] << " ";
    cout << endl;
  }
}
