#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
int a[100010];
struct sort_pred {
  bool operator()(const pair<int, int>& left, const pair<int, int>& right) {
    return left.second < right.second;
  }
};
int main(void) {
  int n, h;
  cin >> n >> h;
  vector<pair<int, int> > v;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    v.push_back(make_pair(i, a[i]));
  }
  sort(v.begin(), v.end(), sort_pred());
  int nonp_f = (v[v.size() - 1].second + v[v.size() - 2].second) -
               (v[0].second + v[1].second);
  int p_fmax =
      max((v[v.size() - 1].second + v[v.size() - 2].second),
          (v[v.size() - 1].second + v[0].second + h)) -
      min((v[1].second + v[0].second + h), (v[2].second + v[1].second));
  int res = min(nonp_f, p_fmax);
  cout << res << endl;
  ;
  int m_i = v[0].first;
  for (int i = 0; i < n; ++i) {
    if (i == m_i && res == p_fmax) {
      cout << 1 << " ";
    } else {
      cout << 2 << " ";
    }
  }
  return 0;
}
