#include <bits/stdc++.h>
using namespace std;
int t, n;
long long int T, a[100000], e[100000];
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  ;
  cin >> t;
  while (t--) {
    cin >> n >> T;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      e[i] = a[i];
    };
    sort(a, a + n);
    set<long long int> s, c, d;
    for (int i = 0; i < n; i++) {
      long long int temp = T - a[i];
      if (s.find(temp) != s.end()) {
        c.insert(a[i]);
        d.insert(temp);
      }
      s.insert(a[i]);
    }
    int b[n];
    for (int i = 0; i < n; i++) {
      if (c.find(e[i]) != c.end() && d.find(e[i]) == d.end())
        b[i] = 0;
      else if (c.find(e[i]) == c.end() && d.find(e[i]) != d.end())
        b[i] = 1;
      else if (c.find(e[i]) != c.end() && d.find(e[i]) != d.end())
        b[i] = -1;
      else
        b[i] = 0;
    }
    bool w = true;
    for (int i = 0; i < n; i++) {
      if (b[i] == -1 && w) {
        b[i] = 0;
        w = false;
      } else if (b[i] == -1 && !w) {
        b[i] = 1;
        w = true;
      }
    }
    for (int i = 0; i < n; i++) cout << b[i] << " ";
    cout << "\n";
  }
  return 0;
}
