#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 3;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t, i, j, n, m, k, l, r, x, y;
  cin >> t;
  while (t--) {
    cin >> n >> k;
    int c[n + 1];
    int a[n + 1];
    memset(c, 0, sizeof(c));
    ;
    vector<int> v;
    for (i = 0; i < n; i++) {
      cin >> a[i];
      if ((a[i] * 2) == k) {
        v.push_back(i);
      }
    }
    map<int, int> mp;
    for (i = 0; i < n; i++) {
      if ((a[i] * 2) != k) {
        l = k - a[i];
        if (mp[l] != 1) {
          c[i] = 1;
          mp[a[i]] = 1;
        }
      }
    }
    m = v.size();
    m /= 2;
    for (i = 0; i < m; i++) {
      c[v[i]] = 1;
    }
    for (i = 0; i < n; i++) {
      cout << c[i] << " ";
    }
    cout << "\n";
  }
  return 0;
}
