#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, h;
  cin >> n >> h;
  vector<pair<int, int> > a;
  a.reserve(n);
  for (int i = 0; i < n; i++) {
    int aa;
    cin >> aa;
    a.push_back(make_pair(aa, i));
  }
  sort(a.begin(), a.end());
  bool to_move = false;
  int pos = a[0].second;
  int dmin = 0;
  if (n > 2) {
    int f0 = a[n - 1].first + a[n - 2].first;
    int fmin0 = a[0].first + a[1].first;
    int d0 = f0 - fmin0;
    dmin = d0;
    int f1 = max(f0, a[0].first + a[n - 1].first + h);
    int fmin1 = min(a[1].first + a[2].first, a[0].first + a[1].first + h);
    int d1 = f1 - fmin1;
    if (d1 < d0) {
      to_move = true;
      dmin = d1;
    }
  }
  cout << dmin << endl;
  for (int i = 0; i < n; i++) {
    if (i > 0) {
      cout << " ";
    }
    if (to_move && i == pos) {
      cout << "2";
    } else {
      cout << "1";
    }
  }
  cout << endl;
  return 0;
}
