#include <bits/stdc++.h>
const double EPS = 1e-9;
const int INT_INF = 2 * (int)1e9;
const long long LL_INF = 8 * (long long)1e18;
const double PI = acos(-1.0);
using namespace std;
int n, h;
pair<int, int> a[100500];
bool A[100500];
int main() {
  cin >> n >> h;
  if (n == 2) {
    printf("0\n1 2\n");
    return 0;
  }
  for (int i = 0; i < (int)n; i++) scanf("%d", &a[i].first), a[i].second = i;
  sort(a, a + n);
  int res = INT_INF;
  int ri = -1;
  for (int i = 0; i < (int)n - 1; i++) {
    int ma;
    int mi;
    if (i < n - 2)
      ma = a[n - 2].first + a[n - 1].first;
    else
      ma = a[i].first + a[i - 1].first;
    ma = max(a[i].first + a[n - 1].first + h, ma);
    if (i > 0)
      mi = a[0].first + a[1].first;
    else
      mi = a[1].first + a[2].first;
    mi = min(mi, a[0].first + a[i + 1].first + h);
    if (ma - mi < res) {
      res = ma - mi;
      ri = i;
    }
  }
  if (a[n - 1].first + a[n - 2].first - (a[0].first + a[1].first) < res) {
    ri = n - 1;
    res = a[n - 1].first + a[n - 2].first - (a[0].first + a[1].first);
  }
  memset(A, 0, sizeof A);
  for (int i = 0; i < (int)ri + 1; i++) A[a[i].second] = 1;
  printf("%d\n", res);
  for (int i = 0; i < (int)n; i++) printf("%d ", A[i] + 1);
  return 0;
}
