#include <bits/stdc++.h>
using namespace std;
template <typename T>
void printvec(vector<T> &vec) {
  for (long long int i = 0; i < vec.size(); i++) cout << vec[i] << " ";
  cout << "\n";
}
vector<bool> is_prime(100000 + 1, true);
void seive(long long int n) {
  is_prime[0] = is_prime[1] = false;
  for (long long int i = 2; i * i <= n; i++) {
    if (is_prime[i]) {
      for (long long int j = i * i; j <= n; j += i) is_prime[j] = false;
    }
  }
}
long long int special_binary(long long int *a, long long int n,
                             long long int x) {
  long long int l = 0;
  long long int r = n - 1;
  long long int m = 0;
  long long int f = x;
  long long int c = 0;
  while (l <= r) {
    if (f > a[n - 1]) return n;
    m = (l + r) / 2;
    if (a[m] <= f) {
      c = m + 1;
      l = m + 1;
    } else {
      r = m - 1;
    }
  }
  return c - 1;
}
long long int power(long long int a, long long int b,
                    long long int p = 1000000007) {
  long long int ans = 1;
  a = a % p;
  while (b > 0) {
    if (b % 2 == 1) {
      ans = (ans * a) % p;
    }
    b = b >> 1;
    a = (a * a) % p;
  }
  return ans;
}
void show(long long int *a, long long int n) {
  long long int size = n;
  for (long long int i = 0; i < size; i++) {
    cout << a[i] << " ";
  }
  cout << "\n";
}
long long int binary_search(long long int *a, long long int n,
                            long long int e) {
  long long int f, l, m;
  f = 0;
  l = n - 1;
  while (f <= l) {
    m = (f + l) / 2;
    if (e == a[m])
      return (m);
    else if (e > a[m])
      f = m + 1;
    else
      l = m - 1;
  }
  return -1;
}
bool cmp(const pair<long long int, long long int> &a,
         const pair<long long int, long long int> &b) {
  return (a.second < b.second);
}
void solve() {
  long long int n, te;
  cin >> n >> te;
  long long int a[n];
  map<long long int, long long int> mp;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  };
  vector<long long int> v1, v2;
  long long int b[n];
  long long int fl = 0;
  for (long long int i = 0; i < n; i++) {
    if (te - a[i] == a[i]) {
      b[i] = fl;
      fl = fl ^ 1;
    } else if (mp[te - a[i]] == 0) {
      b[i] = 0;
      mp[a[i]]++;
    } else {
      b[i] = 1;
    }
  }
  show(b, n);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(15);
  long long int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
