#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
int n, h, a[100005];
pair<int, int> A[100005];
void solve() {
  sort(A, A + n);
  for (int i = (0); i < (n); i++) a[i] = A[i].first;
  int res = a[n - 1] + a[n - 2] - a[0] - a[1], ind = n - 1;
  if (n >= 3) {
    int v = max(a[n - 1] + a[n - 2], a[n - 1] + a[0] + h) -
            min(a[1] + a[2], a[1] + a[0] + h);
    if (res > v) {
      res = v;
      ind = 0;
    }
    v = max(a[n - 3] + a[n - 2], a[n - 1] + a[n - 2] + h) - (a[0] + a[1]);
    if (res > v) {
      res = v;
      ind = n - 2;
    }
  }
  for (int i = 1; i + 2 < n; i++) {
    int v = max(a[n - 1] + a[n - 2], a[n - 1] + a[i] + h) - (a[0] + a[1]);
    if (res > v) {
      res = v;
      ind = i;
    }
  }
  cout << res << endl;
  set<int> L;
  for (int i = (0); i < (ind + 1); i++) L.insert(A[i].second);
  for (int i = (0); i < (n); i++) {
    printf("%d ", (L.find(i) == L.end()) + 1);
  }
  cout << endl;
}
int main() {
  while (cin >> n >> h) {
    for (int i = (0); i < (n); i++) {
      scanf("%d", &A[i].first);
      A[i].second = i;
    }
    solve();
  }
}
