#include <bits/stdc++.h>
using namespace std;
int v[100005], w[100005];
int n, h;
int main() {
  scanf("%d%d", &n, &h);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &v[i]);
    w[i] = v[i];
  }
  sort(v + 1, v + n + 1);
  if (n == 2 || v[n] + v[n - 1] - (v[1] + v[2]) <=
                    max(v[n] + v[n - 1], v[n] + v[1] + h) -
                        min(v[1] + v[2] + h, v[2] + v[3])) {
    printf("%d\n", v[n] + v[n - 1] - (v[1] + v[2]));
    for (int i = 1; i <= n; i++) {
      printf("1 ");
    }
  } else {
    printf("%d\n", max(v[n] + v[n - 1], v[n] + v[1] + h) -
                       min(v[1] + v[2] + h, v[2] + v[3]));
    int used = 0;
    for (int i = 1; i <= n; i++) {
      if (w[i] == v[1] && !used) {
        printf("2 ");
        used = 1;
      } else
        printf("1 ");
    }
  }
  return 0;
}
