#include <bits/stdc++.h>
using namespace std;
int t;
int main() {
  cin >> t;
  while (t--) {
    int n, T;
    cin >> n >> T;
    int a[n + 1], res[n + 1];
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      res[i] = 0;
    }
    map<int, int> tt;
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
      if (T - a[i] == a[i]) {
        cnt++;
        tt[a[i]] = 10;
      }
      if (tt[a[i]] == 0) {
        tt[T - a[i]] = 1;
      }
    }
    cnt /= 2;
    for (int i = 1; i <= n; i++) {
      if (tt[a[i]] == 10 && cnt > 0) {
        res[i] = 0;
        cnt--;
      } else {
        if (tt[a[i]] != 10) {
          res[i] = tt[a[i]];
        } else {
          res[i] = 1;
        }
      }
    }
    for (int i = 1; i <= n; i++) {
      cout << res[i] << " ";
    }
    cout << endl;
  }
}
