#include <bits/stdc++.h>
using namespace std;
pair<int, int> v[100010];
bool luat[100010];
int f(int x, int n, int h);
int main() {
  int n, h;
  cin >> n >> h;
  for (int i(0); i < n; i++) {
    cin >> v[i].first;
    v[i].second = i;
  }
  sort(v, v + n);
  int ans(1e9), pmax;
  for (int i(0); i < n; i++) {
    int x(f(i, n, h));
    if (x < ans) ans = x, pmax = i;
  }
  for (int i(0); i <= pmax; i++) luat[v[i].second] = 1;
  cout << ans << '\n';
  for (int i(0); i < n; i++) {
    cout << (luat[i] ? "1 " : "2 ");
  }
  return 0;
}
int f(int x, int n, int h) {
  int maxim(0), minim(1e9);
  if (x + 2 < n)
    maxim = max(maxim, v[n - 1].first + v[n - 2].first),
    minim = min(minim, v[x + 1].first + v[x + 2].first);
  if (x >= 1)
    maxim = max(maxim, v[x].first + v[x - 1].first),
    minim = min(minim, v[0].first + v[1].first);
  if (x + 1 < n)
    maxim = max(maxim, v[n - 1].first + v[x].first + h),
    minim = min(minim, v[0].first + v[x + 1].first + h);
  return maxim - minim;
}
