#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, h;
  scanf("%lld%lld", &n, &h);
  long long a[n + 1], mn_ind = 0, mn = 1e9, mxx = 0, mnn = LLONG_MAX;
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
    if (a[i] < mn) {
      mn = a[i];
      mn_ind = i;
    }
  }
  if (n == 2) {
    puts("0");
    puts("1 1");
    return 0;
  }
  sort(a + 1, a + n + 1);
  mxx = max(mxx, a[1] + a[n] + h);
  mxx = max(mxx, a[n] + a[n - 1]);
  mnn = min(mnn, a[1] + a[2] + h);
  mnn = min(mnn, a[2] + a[3]);
  if ((mxx - mnn) < (a[n] + a[n - 1] - a[1] - a[2])) {
    printf("%d\n", mxx - mnn);
    for (int i = 1; i <= n; ++i) {
      if (i == mn_ind)
        printf("2 ");
      else
        printf("1 ");
    }
    printf("\n");
  } else {
    printf("%d\n", a[n] + a[n - 1] - a[1] - a[2]);
    for (int i = 1; i <= n; ++i) {
      printf("1 ");
    }
    printf("\n");
  }
  return 0;
}
