#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b);
void print(long long arr[], long long n);
void printv(vector<long long> arr);
signed main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long k;
    cin >> k;
    vector<long long> arr(n);
    unordered_map<long long, long long> m;
    for (long long i = 0; i < n; i++) {
      cin >> arr[i];
      m[arr[i]]++;
    }
    vector<long long> tem = arr;
    sort(tem.begin(), tem.end());
    set<long long> a, b;
    if (arr[0] * 2 != k) a.insert(arr[0]);
    for (long long i = 1; i < n; i++) {
      if (arr[i] * 2 == k) continue;
      if (a.find(k - arr[i]) == a.end())
        a.insert(arr[i]);
      else
        b.insert(arr[i]);
    }
    long long ii = 0;
    for (long long i = 0; i < n; i++) {
      if (a.find(arr[i]) != a.end())
        cout << 1 << " ";
      else if (b.find(arr[i]) != b.end())
        cout << 0 << " ";
      else {
        cout << ii << " ";
        ii = (ii + 1) % 2;
      }
    }
    cout << "\n";
  }
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void print(long long arr[], long long n) {
  for (long long i = 0; i < n; i++) cout << arr[i] << " ";
  cout << "\n";
}
void printv(vector<long long> arr) {
  for (long long i = 0; i < arr.size(); i++) cout << arr[i] << " ";
  cout << "\n";
}
