#include <bits/stdc++.h>
using namespace std;
int a[100000];
int main() {
  int n, h;
  cin >> n >> h;
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  int head = min_element(a, a + n) - a;
  sort(a, a + n);
  int ret1 = max(a[0] + a[n - 1] + h, a[n - 1] + a[n - 2]) -
             min(a[1] + a[2], a[0] + a[1] + h);
  int ret2 = (a[n - 1] + a[n - 2]) - (a[0] + a[1]);
  cout << min(ret1, ret2) << endl;
  if (ret1 < ret2) {
    for (int i = 0; i < (int)(n); i++) {
      if (i == head)
        cout << "2 ";
      else
        cout << "1 ";
    }
  } else {
    for (int i = 0; i < (int)(n); i++) cout << "1 ";
  }
  cout << endl;
  return 0;
}
