#include <bits/stdc++.h>
using namespace std;
int n, h, a[100020], v;
int main() {
  cin >> n >> h;
  for (int i = 0; i < n; i++) cin >> a[i];
  int p = min_element(a, a + n) - a;
  sort(a, a + n);
  int t1 = a[n - 1] + a[n - 2] - a[0] - a[1],
      t2 = max(a[n - 1] + a[n - 2], a[0] + a[n - 1] + h) -
           min(a[0] + a[1] + h, a[1] + a[2]);
  if (n < 3 || t2 > t1) p = n;
  cout << min(t1, t2) << endl;
  for (int i = 0; i < n; i++) cout << (p == i) + 1 << " ";
  return 0;
}
