#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
const int INF = 1e9 + 7;
int n, h, a[N];
struct Node {
  int v, id;
  Node() {}
  Node(int _v, int _id) { v = _v, id = _id; }
  bool operator<(const Node &p) const {
    if (v != p.v) return v < p.v;
    return id < p.id;
  }
} nd[N];
void solve() {
  int mn, mx, p = n, diff = (a[n] + a[n - 1]) - (a[1] + a[2]);
  mn = min(a[1] + a[2] + h, a[2] + a[3]);
  mx = max(a[n] + a[n - 1], a[1] + a[n] + h);
  if (mx - mn < diff) p = 1, diff = mx - mn;
  mn = a[1] + a[2];
  mx = a[n] + a[n - 1] + h;
  if (mx - mn < diff) p = n - 1, diff = mx - mn;
  for (int i = (2), I = (n - 1); i < I; ++i) {
    mn = a[1] + a[2];
    mx = a[n] + max(a[n - 1], a[i] + h);
    if (mx - mn < diff) p = i, diff = mx - mn;
  }
  for (int i = (1), I = (n + 1); i < I; ++i) a[nd[i].id] = 1 + (i > p);
  printf("%d\n", diff);
  for (int i = (1), I = (n + 1); i < I; ++i) {
    if (i - 1) putchar(' ');
    printf("%d", a[i]);
  }
}
int main() {
  scanf("%d%d", &n, &h);
  for (int i = (1), I = (n + 1); i < I; ++i)
    scanf("%d", &a[i]), nd[i] = Node(a[i], i);
  sort(a + 1, a + n + 1);
  sort(nd + 1, nd + n + 1);
  a[n + 1] = INF;
  solve();
  return 0;
}
