#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long T;
  cin >> T;
  for (long long testcase = 0; testcase < T; ++testcase) {
    long long N, sum;
    cin >> N >> sum;
    vector<long long> A(N);
    vector<long long> B, C;
    long long cnt = 0;
    vector<long long> ans(N, 0);
    for (long long i = 0; i < N; ++i) {
      cin >> A.at(i);
      if (A.at(i) * 2 < sum) {
        ans.at(i) = 0;
      } else if (A.at(i) * 2 > sum) {
        C.push_back(A.at(i));
        ans.at(i) = 1;
      } else {
        if (cnt % 2 == 0) {
          ans.at(i) = 0;
        } else {
          ans.at(i) = 1;
        }
        cnt += 1;
      }
    }
    for (long long i = 0; i < N; ++i) {
      cout << ans.at(i) << " ";
    }
    cout << "\n";
  }
}
