#include <bits/stdc++.h>
using namespace std;
set<int>::iterator it;
int s[100005];
int ans[100005];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int pd = 0;
    int n, t;
    scanf("%d %d", &n, &t);
    for (int i = 1; i <= n; i++) {
      scanf("%d", &s[i]);
      if (s[i] < t / 2)
        ans[i] = 0;
      else if (s[i] > t / 2)
        ans[i] = 1;
      else {
        if (t % 2 == 1)
          ans[i] = 0;
        else {
          ans[i] = pd;
          pd ^= 1;
        }
      }
    }
    for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
    printf("\n");
  }
}
