#include <bits/stdc++.h>
using namespace std;
template <class T>
void PV(T x) {
  for (__typeof__((x).begin()) i = (x).begin(); i != (x).end(); ++i)
    cout << *i << " ";
  cout << endl;
}
vector<int> a;
int main(int argc, char *argv[]) {
  int n, h;
  cin >> n >> h;
  a.resize(n);
  for (auto &ai : a) cin >> ai;
  if (n == 2) {
    cout << 0 << endl;
    for (int n_ = (n), i = 0; i < n_; ++i) cout << 1 << " ";
    cout << endl;
    return 0;
  }
  vector<int> id;
  for (int n_ = (n), i = 0; i < n_; ++i) id.push_back(i);
  sort((id).begin(), (id).end(), [](int l, int r) { return a[l] < a[r]; });
  int mini0 = (a[id[n - 1]] + a[id[n - 2]]) - (a[id[0]] + a[id[1]]);
  int mini1 = max(a[id[n - 1]] + a[id[n - 2]], a[id[n - 1]] + a[id[0]] + h) -
              min(a[id[1]] + a[id[2]], a[id[0]] + a[id[1]] + h);
  cout << min(mini0, mini1) << endl;
  if (mini0 < mini1) {
    for (int n_ = (n), i = 0; i < n_; ++i) cout << 1 << " ";
    cout << endl;
  } else {
    vector<int> ans(n, 1);
    ans[id[0]] = 2;
    PV(ans);
  }
  return 0;
}
