#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  srand(time(NULL));
  ;
  long long T = 1;
  cin >> T;
  while (T--) {
    long long n, k;
    cin >> n >> k;
    long long a[n];
    map<long long, long long> m;
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      m[a[i]] = 1;
    }
    vector<long long> ans(n, 0);
    long long c = 0, c2 = 0;
    for (long long i = 0; i < n; i++) {
      if (2 * a[i] == k) {
        c++;
        continue;
      }
      if (m[a[i]] == 1) {
        m[a[i]] = 2;
        m[k - a[i]] = 3;
      }
    }
    for (long long i = 0; i < n; i++) {
      if (2 * a[i] == k) {
        if (c2 < c / 2)
          c2++, cout << "0 ";
        else
          cout << "1 ";
      } else if (m[a[i]] == 2)
        cout << "0 ";
      else
        cout << "1 ";
    }
    cout << "\n";
  }
  return 0;
}
