#include <bits/stdc++.h>
const int MAXN = 100005;
using namespace std;
int n, h, group[MAXN];
struct Partition {
  int number;
  int value;
};
Partition a[MAXN];
bool cmp(Partition x, Partition y) { return x.value < y.value; }
int scan() {
  int t = 0, m = 1;
  char c;
  c = getchar();
  while ((c < '0' || c > '9') and c != '-') c = getchar();
  if (c == '-') c = getchar(), m = -1;
  while (c >= '0' && c <= '9') t = (t << 3) + (t << 1) + c - '0', c = getchar();
  return (t * m);
}
int main() {
  std::ios::sync_with_stdio(false);
  for (int i = 0; i < MAXN; i++) group[i] = 1;
  n = scan();
  h = scan();
  for (int i = 1; i <= n; i++) {
    a[i].value = scan();
    a[i].number = i;
  }
  sort(a + 1, a + n + 1, cmp);
  if (n == 2)
    cout << 0 << endl << 1 << " " << 1;
  else {
    int res1, res2;
    res1 = a[n - 1].value + a[n].value - a[1].value - a[2].value;
    res2 = max(a[n - 1].value + a[n].value, a[1].value + a[n].value + h) -
           min(a[1].value + a[2].value + h, a[2].value + a[3].value);
    if (res1 < res2) {
      cout << res1 << endl;
      for (int i = 1; i <= n; i++) group[i] = 2;
    } else {
      cout << res2 << endl;
      group[a[1].number] = 2;
    }
    for (int i = 1; i <= n; i++) cout << group[i] << " ";
  }
  return 0;
}
