#include <bits/stdc++.h>
using namespace std;
struct numb {
  int val, id, resp;
};
numb v[100100];
bool comp1(numb a, numb b) { return a.val < b.val; }
bool comp2(numb a, numb b) { return a.id < b.id; }
int absol(int k) {
  if (k > 0) {
    return k;
  }
  return -k;
}
int main() {
  int n, h, i, r1, r2, r, resp, corte;
  scanf("%d %d", &n, &h);
  for (i = 0; i < n; i++) {
    scanf("%d", &v[i].val);
    v[i].id = i;
    v[i].resp = 2;
  }
  sort(v, v + n, comp1);
  if (n == 2) {
    resp = 0;
  } else {
    resp = (v[n - 1].val + v[n - 2].val) - (v[0].val + v[1].val);
    corte = 0;
    r = max(v[n - 1].val + v[n - 2].val, v[n - 1].val + v[0].val + h) -
        min(v[0].val + v[1].val + h, v[1].val + v[2].val);
    if (r < resp) {
      resp = r;
      corte = 1;
    }
    if (n >= 5) {
      r1 = max(v[n - 1].val + v[n - 2].val, v[n - 1].val + v[2].val + h);
      r2 = min(v[0].val + v[1].val + h, v[0].val + v[2].val);
      if (r1 - r2 < resp) {
        resp = r1 - r2;
        corte = 2;
      }
    }
    if (corte == 1) {
      v[0].resp = 1;
    } else if (corte == 2) {
      v[0].resp = 1;
      v[2].resp = 1;
    }
  }
  sort(v, v + n, comp2);
  printf("%d\n", resp);
  for (i = 0; i < n; i++) {
    printf("%d", v[i].resp);
    if (i + 1 < n) {
      printf(" ");
    } else {
      printf("\n");
    }
  }
  scanf("%*d");
  return 0;
}
