#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, h;
  cin >> n >> h;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int minIndex = min_element((a).begin(), (a).end()) - a.begin();
  sort((a).begin(), (a).end());
  int f1 = (a[n - 1] + a[n - 2]) - (a[1] + a[0]);
  a[0] += h;
  sort((a).begin(), (a).end());
  int f2 = (a[n - 1] + a[n - 2]) - (a[1] + a[0]);
  if (f1 < f2) {
    cout << f1 << endl;
    for (int i = 0; i < n; i++) {
      cout << 1 << " \n"[i == n - 1];
    }
  } else {
    cout << f2 << endl;
    for (int i = 0; i < n; i++) {
      if (i == minIndex)
        cout << 2 << " \n"[i == n - 1];
      else
        cout << 1 << " \n"[i == n - 1];
    }
  }
  return 0;
}
