#include <bits/stdc++.h>
using namespace std;
long long mod = (long long)1e+9 + 9;
int main() {
  int n, h;
  cin >> n >> h;
  vector<pair<int, int> > a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a.begin(), a.end());
  vector<int> ans(n, 1);
  if (n == 2) {
    cout << 0 << endl << "1 1";
    return 0;
  }
  int extr = a[n - 1].first + a[n - 2].first - a[0].first - a[1].first;
  if (max(a[n - 1].first + a[n - 2].first, a[0].first + a[n - 1].first + h) -
          min(a[0].first + a[1].first + h, a[1].first + a[2].first) <
      extr) {
    extr =
        max(a[n - 1].first + a[n - 2].first, a[0].first + a[n - 1].first + h) -
        min(a[0].first + a[1].first + h, a[1].first + a[2].first);
    ans[a[0].second] = 2;
  }
  cout << extr << endl;
  for (int i = 0; i < n; ++i) cout << ans[i] << " ";
  return 0;
}
