#include <bits/stdc++.h>
using namespace std;
int sol[100100];
vector<pair<int, int> > a;
int N, h, i, x, gmin, jbest;
void greedy() {
  int j, fmin, fmax;
  jbest = -2;
  gmin = -1;
  for (j = N - 2; j >= 0; j--) {
    if (j == N - 2)
      fmax = fmin = a[N - 2].first + a[N - 1].first + h;
    else {
      fmax =
          max(a[N - 2].first + a[N - 1].first, a[j].first + a[N - 1].first + h);
      fmin =
          min(a[j].first + a[j + 1].first + h, a[j + 1].first + a[j + 2].first);
    }
    if (j >= 2) {
      fmin = min(fmin, a[0].first + a[1].first + h),
      fmin = min(fmin, a[1].first + a[2].first);
      fmin = min(fmin, a[0].first + a[j + 1].first);
    } else if (j == 1) {
      fmin = min(fmin, a[0].first + a[1].first + h);
      fmin = min(fmin, a[0].first + a[j + 1].first);
    }
    if (gmin < 0 || fmax - fmin < gmin) {
      gmin = fmax - fmin;
      jbest = j;
    }
  }
  fmax = a[N - 1].first + a[N - 2].first;
  fmin = a[0].first + a[1].first;
  if (gmin < 0 || fmax - fmin < gmin) {
    gmin = fmax - fmin;
    jbest = -1;
  }
}
int main() {
  scanf("%d %d", &N, &h);
  for (i = 0; i < N; i++) {
    scanf("%d", &x);
    a.push_back(make_pair(x, i));
  }
  sort(a.begin(), a.end());
  greedy();
  for (i = N - 1; i > jbest; i--) sol[a[i].second] = 0;
  if (jbest >= 0) sol[a[jbest].second] = 1;
  if (jbest >= 2) {
    sol[a[0].second] = 0;
    sol[a[1].second] = 1;
    sol[a[2].second] = 1;
  } else if (jbest == 1) {
    sol[a[0].second] = 0;
  }
  for (i = 3; i < jbest; i++) sol[a[i].second] = 1;
  printf("%d\n", gmin);
  for (i = 0; i < N; i++) {
    printf("%d", sol[i] + 1);
    if (i < N) printf(" ");
  }
  printf("\n");
  return 0;
}
