#include <bits/stdc++.h>
using namespace std;
const int MaxN = 200005;
struct nesto {
  int num, idx;
} a[MaxN];
bool cmp(nesto a, nesto b) { return a.num < b.num; }
int sola[MaxN];
int main() {
  int n, h;
  scanf("%d%d", &n, &h);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i].num);
    a[i].idx = i;
  }
  if (n == 2) {
    printf("0\n1 1\n");
    return 0;
  }
  for (int i = 1; i <= n; i++) sola[i] = 1;
  sort(a + 1, a + n + 1, cmp);
  int sol = a[n].num + a[n - 1].num - a[1].num - a[2].num;
  int maxx = max(a[n - 1].num + a[n].num, a[1].num + a[n].num + h);
  int minn = min(a[2].num + a[3].num, a[1].num + a[2].num + h);
  if (maxx - minn < sol) {
    sol = maxx - minn;
    sola[a[1].idx] = 2;
  }
  printf("%d\n", sol);
  printf("%d", sola[1]);
  for (int i = 2; i <= n; i++) printf(" %d", sola[i]);
  printf("\n");
  return 0;
}
