#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
bool compare(pair<int, int> quan1, pair<int, int> quan2) {
  return quan1.second < quan2.second;
}
long long power(long long base, int expo) {
  long long ans = 1;
  while (expo > 0) {
    if (expo % 2 == 1) {
      ans *= base;
    }
    base *= base;
    expo /= 2;
  }
  return ans;
}
long long func(long long arr[], long long n, long long k) {
  int calculate[n][31];
  for (auto i = 0; i < n; i++) {
    for (auto j = 0; j <= 30; j++) {
      calculate[i][j] = 0;
    }
  }
  long long answer = 0;
  vector<pair<long long, int>> netvalue;
  long long y = 0;
  for (auto i = 0; i < n; i++) {
    while (arr[i] > 0) {
      calculate[i][y] = arr[i] % 2;
      arr[i] = arr[i] / 2;
      y++;
    }
    reverse(calculate[i], calculate[i] + 31);
    y = 0;
  }
  for (auto j = 0; j <= 30; j++) {
    for (auto i = 1; i < n; i++) {
      calculate[i][j] += calculate[i - 1][j];
    }
  }
  for (auto i = 0; i <= 30; i++) {
    netvalue.push_back(
        make_pair((power(2, (30 - i)) * calculate[n - 1][i]), (30 - i)));
  }
  sort(netvalue.begin(), netvalue.end(), compare);
  long long u = 0;
  while (k > 0) {
    answer += power(2, netvalue[u].second);
    k--;
    u++;
  }
  return answer;
}
void dfSearch(int person, int visited[], unordered_set<int>& settt,
              vector<pair<int, long double>> vec[],
              unordered_map<int, long double> personTotime) {
  visited[person] = 1;
  long double lasttime;
  lasttime = personTotime[person];
  settt.insert(person);
  for (int j = 0; j < vec[person].size(); j++) {
    if ((visited[vec[person][j].first] == 0) &&
        (vec[person][j].second >= lasttime)) {
      personTotime[vec[person][j].first] = vec[person][j].second;
      dfSearch(vec[person][j].first, visited, settt, vec, personTotime);
    }
  }
}
long long lessFindit(long long ele) {
  long long start = 1;
  long long ending = 100000000;
  long long middle;
  long long ans = 0;
  while (start <= ending) {
    middle = (start + ending) / 2;
    if (ele >= ((middle * (middle + 1)) / 2)) {
      start = middle + 1;
      ans = middle;
    } else {
      ending = middle - 1;
    }
  }
  return ans;
}
long long exponentiation(long long num_one, long long num_two, long long mod) {
  long long answer = 1;
  num_one = num_one % mod;
  while (num_two > 0) {
    if (num_two & 1) {
      answer = (answer * num_one) % mod;
    }
    num_two = num_two >> 1;
    num_one = (num_one * num_one) % mod;
  }
  return answer % mod;
}
long long mod_inverse(long long number, long long mod) {
  return exponentiation(number, mod - 2, mod) % mod;
}
long long combi(long long n, long long k, long long mod) {
  if (k == 0) {
    return 1;
  }
  long long factorial[n + 1];
  factorial[0] = 1;
  for (long long i = 1; i <= n; i++) {
    factorial[i] = factorial[i - 1] * i % mod;
  }
  return ((factorial[n] % mod) * mod_inverse(factorial[k], mod) % mod *
          mod_inverse(factorial[n - k], mod) % mod) %
         mod;
}
long long fastModularExpo(long long base, long long expo) {
  long long answer = 1;
  base = base % mod;
  while (expo > 0) {
    if (expo % 2 == 1) {
      answer *= base;
      answer = answer % mod;
    }
    base *= base;
    base = base % mod;
    expo /= 2;
  }
  return (answer % mod);
}
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  } else {
    return gcd(b, a % b);
  }
}
long w;
void fun(vector<pair<long, long>> vec, long n, long max_cost[100][101]) {
  for (long i = 0; i < n; i++) {
    for (long j = 1; j <= w; j++) {
      if (vec[i].second <= j) {
        max_cost[i][j] =
            max(max_cost[i][j], max_cost[i][j - vec[i].second] + vec[i].first);
      } else {
        max_cost[i][j] = max_cost[i - 1][j];
      }
    }
  }
}
long calculate(vector<long> v, long l, long r, long k) {
  v.push_back(l);
  v.push_back(r);
  k = k / 2;
  long sum = 0;
  for (long i = 0; i <= (v.size() - 1 - k); i++) {
    sum += v[i];
  }
  return sum;
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    long long arr[n];
    long long a[n];
    unordered_map<long long, long long> m, mm;
    for (long long i = 0; i < n; i++) {
      cin >> arr[i];
      a[i] = arr[i];
    }
    long long ans = 0;
    long long l = 0;
    long long r = n - 1;
    long long val1 = 1;
    long long val2 = 0;
    cout << val1 << " ";
    m[arr[0]]++;
    for (long long i = 1; i < n; i++) {
      if (m[k - arr[i]] > mm[k - arr[i]]) {
        cout << val2 << " ";
        mm[arr[i]]++;
      } else {
        cout << val1 << " ";
        m[arr[i]]++;
      }
    }
    cout << endl;
  }
  return 0;
}
