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