#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, h;
  cin >> n >> h;
  vector<pair<long long, long long> > v(n);
  for (long long i = 0; i < n; i++) {
    cin >> v[i].first;
    v[i].second = i;
  }
  sort(v.begin(), v.end());
  long long ans = v[n - 1].first + v[n - 2].first - v[0].first - v[1].first;
  long long mi = v[0].first + v[1].first + h;
  if (n > 2) mi = min(mi, v[1].first + v[2].first);
  long long mx =
      max(v[n - 1].first + v[n - 2].first, v[n - 1].first + v[0].first + h);
  if (ans < mx - mi) {
    cout << ans << '\n';
    for (long long i = 0; i < n; i++) cout << 1 << " ";
    return 0;
  }
  cout << mx - mi << '\n';
  for (long long i = 0; i < n; i++) {
    if (i == v[0].second)
      cout << 2 << " ";
    else
      cout << 1 << " ";
  }
}
