#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, int> > v;
long long n, h, ans1, ans2, ans3, a, ans[200000];
int main() {
  cin >> n >> h;
  for (int i = 0; i < n; i++) {
    cin >> a;
    v.push_back(pair<long long, int>(a, i));
  }
  if (n == 2) {
    cout << 0 << endl << 1 << " " << 1 << endl;
    return 0;
  }
  sort(v.begin(), v.end());
  ans1 = v.back().first + v[v.size() - 2].first - v[1].first - v[0].first;
  ans2 = v.back().first + max(v[v.size() - 2].first, v[0].first + h) -
         v[1].first - min(v[0].first + h, v[2].first);
  ans3 = v.back().first + max(v[v.size() - 2].first, v[2].first + h) -
         v[0].first - min(v[1].first + h, v[2].first);
  cout << min(ans1, min(ans2, ans3)) << endl;
  if (ans1 <= ans2 && ans1 <= ans3) {
    for (int i = 0; i < n; i++) cout << 1 << " ";
    cout << endl;
  } else if (ans2 <= ans3) {
    ans[v[0].second] = 1;
    for (int i = 0; i < n; i++) cout << ans[i] + 1 << " ";
    cout << endl;
  } else {
    ans[v[0].second] = 1;
    ans[v[2].second] = 1;
    for (int i = 0; i < n; i++) cout << ans[i] + 1 << " ";
    cout << endl;
  }
}
