#include <bits/stdc++.h>
using namespace std;
int main() {
  int test;
  cin >> test;
  while (test--) {
    long long n, t;
    cin >> n >> t;
    map<long long, long long> mp1, mp2;
    vector<long long> v;
    for (int i = 0; i < n; i++) {
      long long a;
      cin >> a;
      if (!mp1[t - a]) {
        mp1[a]++;
        v.push_back(1);
      } else if (!mp2[t - a]) {
        mp2[a]++;
        v.push_back(0);
      } else {
        if (mp1[a] > mp2[a]) {
          v.push_back(0);
          mp2[a]++;
        } else {
          v.push_back(1);
          mp1[a]++;
        }
      }
    }
    for (int i = 0; i < v.size(); i++) {
      cout << v[i] << " ";
    }
    cout << endl;
  }
}
