#include <bits/stdc++.h>
using namespace std;
struct node {
  int v, o, tag;
} a[101000];
bool cmp(node x, node y) { return x.v < y.v; }
bool cmp2(node x, node y) { return x.o < y.o; }
int n, h, i;
int h1, h2, ans;
int work1() {
  int ret = 0, ma = -1, mi = 200010000;
  ma = a[n].v + a[n - 1].v;
  mi = a[1].v + a[2].v;
  ret = ma - mi;
  return ret;
}
int work2() {
  int ma, mi;
  ma = max(a[1].v + a[n].v + h, a[n].v + a[n - 1].v);
  mi = min(a[1].v + a[2].v + h, a[2].v + a[3].v);
  return ma - mi;
}
int main() {
  scanf("%d%d", &n, &h);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i].v);
    a[i].o = i;
    a[i].tag = 1;
  }
  sort(a + 1, a + n + 1, cmp);
  if (n == 2) {
    printf("0\n");
    printf("1 1\n");
    return 0;
  }
  h1 = work1();
  h2 = work2();
  a[1].tag = 2;
  sort(a + 1, a + n + 1, cmp2);
  if (h1 <= h2) {
    printf("%d\n", h1);
    for (i = 1; i <= n; i++) {
      printf("%d", 1);
      if (i != n) printf(" ");
    }
    printf("\n");
  } else {
    printf("%d\n", h2);
    for (i = 1; i <= n; i++) {
      if (a[i].tag == 1)
        printf("1");
      else
        printf("2");
      if (i != n) printf(" ");
    }
    printf("\n");
  }
  return 0;
}
