#include <bits/stdc++.h>
using namespace std;
int n, h;
pair<long long, int> a[int(1e6)];
int main() {
  cin >> n >> h;
  int mni = 1;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a + 1, a + n + 1);
  mni = a[1].second;
  long long mx = max(a[1].first + a[n].first + h, a[n].first + a[n - 1].first);
  long long mn = a[1].first + a[2].first + h;
  if (n > 2) mn = min(mn, a[2].first + a[3].first);
  if ((a[n].first + a[n - 1].first) - (a[1].first + a[2].first) < mx - mn) {
    cout << (a[n].first + a[n - 1].first) - (a[1].first + a[2].first) << "\n";
    for (int i = 1; i <= n; ++i) cout << "1 ";
    return 0;
  }
  cout << mx - mn << "\n";
  for (int i = 1; i <= n; ++i)
    if (i == mni)
      cout << "1 ";
    else
      cout << "2 ";
  cout << "\n";
  return 0;
}
