#include <bits/stdc++.h>
using namespace std;
int n, h;
vector<pair<int, int> > a;
int main() {
  scanf("%d%d", &n, &h);
  a.resize(n);
  int x;
  if (n == 2) {
    printf("0\n1 1\n");
    return 0;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    a[i] = make_pair(x, i);
  }
  sort(a.begin(), a.end());
  int res1 = (a[n - 1].first + a[n - 2].first) - (a[0].first + a[1].first);
  int res2 =
      max(a[n - 1].first + a[n - 2].first, a[n - 1].first + a[0].first + h) -
      min(a[1].first + a[2].first, a[0].first + a[1].first + h);
  if (res1 < res2) {
    printf("%d\n", res1);
    for (int i = 0; i < n; i++) printf("1 ");
    printf("\n");
  } else {
    printf("%d\n", res2);
    for (int i = 0; i < n; i++) printf("%d ", 2 - (i == a[0].second));
    printf("\n");
  }
  return 0;
}
