#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 7;
int T, n, t, a[N];
map<long long, long long> mp;
int main() {
  scanf("%d", &T);
  while (T--) {
    mp.clear();
    scanf("%d%d", &n, &t);
    for (int i = 1; i <= n; ++i) {
      scanf("%d", &a[i]);
    }
    if (t % 2 == 1) {
      for (int i = 1; i <= n; ++i) {
        mp[a[i]] = 1;
        mp[t - a[i]] = 0;
      }
      for (int i = 1; i <= n; ++i) {
        printf("%d ", mp[a[i]]);
      }
      printf("\n");
    } else {
      for (int i = 1; i <= n; ++i) {
        mp[a[i]] = 1;
        mp[t - a[i]] = 0;
      }
      int flag = 0;
      for (int i = 1; i <= n; ++i) {
        if (a[i] * 2 == t) {
          printf("%d ", flag);
          flag = 1 - flag;
        } else {
          printf("%d ", mp[a[i]]);
        }
      }
      printf("\n");
    }
  }
  return 0;
}
