#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, h;
  cin >> n >> h;
  vector<pair<int, int> > v(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i].first;
    v[i].second = i;
  }
  sort(v.begin(), v.end());
  vector<int> sub(n, 1);
  int god = v[n - 1].first + v[n - 2].first - v[0].first - v[1].first;
  int nmin = v[0].first + v[1].first + h;
  if (n > 2) nmin = min(nmin, v[1].first + v[2].first);
  if (max(v[n - 1].first + v[n - 2].first, v[n - 1].first + v[0].first + h) -
          nmin <
      god)
    sub[v[0].second] = 2;
  cout << min(god, max(v[n - 1].first + v[n - 2].first,
                       v[n - 1].first + v[0].first + h) -
                       nmin)
       << endl;
  for (int i = 0; i < n; ++i) {
    if (i) cout << " ";
    cout << sub[i];
  }
  cout << endl;
}
