#include <bits/stdc++.h>
using namespace std;
struct my {
  int v;
  int i;
};
bool cmp(my c, my d) { return (c.v < d.v); }
my a[100001];
int main() {
  int n, h;
  cin >> n >> h;
  for (int i = 0; i < n; i++) {
    cin >> a[i].v;
    a[i].i = i;
  }
  sort(a, a + n, cmp);
  int max1 = a[n - 1].v + a[n - 2].v;
  int min1 = a[0].v + a[1].v;
  int diff = max1 - min1;
  int max2 = max(max1, a[n - 1].v + a[0].v + h);
  int min2 = min1 + h;
  if (n > 2) min2 = min(min2, a[1].v + a[2].v);
  if ((max2 - min2) < diff) goto change;
  {
    cout << diff << endl;
    for (int i = 0; i < n; i++) {
      cout << 2 << " ";
    }
    cout << endl;
  }
  return 0;
change : {
  cout << (max2 - min2) << endl;
  int idx = a[0].i;
  for (int i = 0; i < idx; i++) {
    cout << 2 << " ";
  }
  cout << 1 << " ";
  for (int i = idx + 1; i < n; i++) {
    cout << 2 << " ";
  }
  cout << endl;
}
  return 0;
}
