#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > vec;
int n, h;
bool cmp_by_index(const pair<int, int> &lhs, const pair<int, int> &rhs) {
  return lhs.second < rhs.second;
}
pair<int, int> solve() {
  if (n == 2) {
    return make_pair(0, 0);
  }
  int delta1 =
      vec[n - 1].first + vec[n - 2].first - vec[0].first - vec[1].first;
  int ma = max(vec[n - 1].first + vec[n - 2].first,
               vec[n - 1].first + vec[0].first + h);
  int mi = min(vec[0].first + vec[1].first + h, vec[1].first + vec[2].first);
  int delta2 = ma - mi;
  if (delta1 < delta2) return make_pair(0, delta1);
  return make_pair(1, delta2);
}
int main() {
  cin >> n >> h;
  vec.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> vec[i].first;
    vec[i].second = i;
  }
  sort(vec.begin(), vec.end());
  int mi = vec[0].first;
  pair<int, int> ret = solve();
  sort(vec.begin(), vec.end(), cmp_by_index);
  cout << ret.second << endl;
  for (int i = 0; i < n; i++) {
    if (ret.first == 1 && vec[i].first == mi) {
      cout << 2 << " ";
      mi = -1;
    } else {
      cout << 1 << " ";
    }
  }
  cout << endl;
  return 0;
}
