#include <bits/stdc++.h>
using namespace std;
const int N = 200050;
int n, A[N], I[N], h;
bool cmpIndex(int a, int b) { return A[a] < A[b]; }
int main() {
  scanf("%d%d", &n, &h);
  for (int i = 1; i <= n; ++i) scanf("%d", A + i), I[i] = i;
  sort(I + 1, I + 1 + n, cmpIndex);
  int r1 = A[I[n]] + A[I[n - 1]] - (A[I[1]] + A[I[2]]),
      r2 = max(A[I[n]] + A[I[n - 1]], A[I[n]] + A[I[1]] + h) -
           min(A[I[2]] + A[I[3]], A[I[1]] + A[I[2]] + h);
  if (r1 < r2) {
    printf("%d\n", r1);
    for (int i = 1; i <= n; ++i) printf("1 ");
    puts("");
  } else {
    printf("%d\n", r2);
    for (int i = 1; i <= n; ++i)
      if (i == I[1])
        printf("1 ");
      else
        printf("2 ");
    puts("");
  }
}
