#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    vector<long long> v(n);
    for (long long i = 0; i < n; i++) {
      cin >> v[i];
    }
    unordered_map<long long, long long> mapV;
    vector<long long> index;
    long long c = 0;
    for (long long i = 0; i < n; i++) {
      long long val = k - v[i];
      if (mapV[val] == 0) {
        if (k % 2 == 0 && v[i] == k / 2) {
          if (c % 2 == 0) index.push_back(i);
          c++;
          continue;
        }
        mapV[v[i]]++;
        index.push_back(i);
      }
    }
    for (long long i = 0; i < index.size(); i++) {
      v[index[i]] = -1;
    }
    for (long long i = 0; i < n; i++) {
      if (v[i] == -1)
        v[i] = 0;
      else
        v[i] = 1;
    }
    for (long long i = 0; i < n; i++) {
      cout << v[i] << " ";
    }
    cout << endl;
  }
}
