#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T sqr(const T& a) {
  return a * a;
}
template <typename T>
inline int sign(const T& a) {
  return a < 0 ? -1 : a > 0;
}
void task();
int main() {
  task();
  return 0;
}
int n, h;
pair<int, int> a[int(1e5) + 10];
void task() {
  ios_base::sync_with_stdio(0);
  cin >> n >> h;
  a[2].first = 1e9;
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a, a + n);
  int b = a[n - 1].first + a[n - 2].first - (a[0].first + a[1].first);
  int c =
      max(h + a[0].first + a[n - 1].first, a[n - 1].first + a[n - 2].first) -
      min(h + a[0].first + a[1].first, a[1].first + a[2].first);
  if (b < c) {
    cout << b << "\n";
  } else {
    cout << c << "\n";
    a[a[0].second].first = -1;
  }
  for (int i = 0; i < n; ++i)
    if (a[i].first != -1)
      cout << 1 << ' ';
    else
      cout << 2 << ' ';
}
