#include <bits/stdc++.h>
using namespace std;
const int maxn = 101010;
struct thing {
  int val, who;
} a[maxn];
bool cmp(const thing &a, const thing &b) { return a.val < b.val; }
int main() {
  int n, h;
  scanf("%d%d", &n, &h);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i].val);
    a[i].who = i;
  }
  if (n == 2) {
    printf("0\n1 1\n");
    return 0;
  }
  sort(a + 1, a + 1 + n, cmp);
  int ans1 = (a[n].val + a[n - 1].val) - (a[1].val + a[2].val);
  int ans2 = max(a[n].val + a[n - 1].val, a[1].val + a[n].val + h) -
             min(a[2].val + a[3].val, a[1].val + a[2].val + h);
  if (ans1 <= ans2) {
    printf("%d\n", ans1);
    for (int i = 1; i <= n; ++i) printf("1 ");
  } else {
    printf("%d\n", ans2);
    for (int i = 1; i < a[1].who; ++i) printf("1 ");
    printf("2 ");
    for (int i = a[1].who + 1; i <= n; ++i) printf("1 ");
  }
  return 0;
}
