#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int tc;
  cin >> tc;
  while (tc--) {
    int n, k, cn = 0;
    map<int, int> m;
    set<int> s;
    map<int, int>::iterator it;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      m[a[i]]++;
      if (k % 2 == 0) {
        if (a[i] == k / 2) cn++;
      }
    }
    for (it = m.begin(); it != m.end(); it++) {
      int num = it->first;
      if (s.count(num) == 0) {
        if (k % 2 == 0 and num == k / 2) continue;
        if (m[abs(num - k)]) {
          s.insert(abs(num - k));
        }
      }
    }
    cn /= 2;
    for (int i = 0; i < n; i++) {
      if (k % 2 == 0 and a[i] == k / 2) {
        if (cn) {
          cout << 1 << " ";
          cn--;
        } else
          cout << 0 << " ";
      } else {
        if (s.count(a[i]))
          cout << 1 << " ";
        else
          cout << 0 << " ";
      }
    }
    cout << endl;
  }
  return 0;
}
