#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3F3F3F3F;
template <class T>
inline T& checkmin(T& a, T b) {
  if (b < a) a = b;
}
template <class T>
inline T& checkmax(T& a, T b) {
  if (b > a) a = b;
}
const int N = 131072;
int n;
long long h;
pair<int, int> a[N];
int g[N], ans[N];
int go() {
  for (int i = 0; i < (n); ++i) g[i] = 1;
  if (n == 2) return 0;
  int ans = (a[n - 1].first + a[n - 2].first) - (a[0].first + a[1].first);
  int last = -1;
  for (int i = 0; i < (n); ++i) {
    long long max1 = a[n - 1].first + a[n - 2].first;
    if (i >= n - 2) max1 += a[n - 3].first - a[i].first;
    checkmax(max1, a[n - 1].first + a[min(n - 2, i)].first + h);
    long long min1 = a[0].first + a[1].first;
    if (i <= 1) min1 += a[2].first - a[i].first;
    checkmin(min1, a[0].first + a[max(1, i)].first + h);
    if (max1 - min1 < ans) {
      if (last != -1) {
        g[last] = 1;
      }
      last = i;
      g[i] = 2;
      ans = max1 - min1;
    }
  }
  return ans;
}
int main() {
  cin >> n >> h;
  for (int i = 0; i < (n); ++i) {
    scanf("%d", &a[i].first);
    a[i].second = i;
  }
  sort(a, a + n);
  printf("%d\n", go());
  for (int i = 0; i < (n); ++i) ans[a[i].second] = g[i];
  for (int i = 0; i < (n); ++i) printf("%d ", ans[i]);
}
