#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, h;
  cin >> n >> h;
  vector<pair<int, int> > vals;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    vals.push_back(pair<int, int>(x, i));
  }
  sort(vals.begin(), vals.end());
  int m1 = vals[0].first + vals[1].first;
  int M1 = vals[vals.size() - 1].first + vals[vals.size() - 2].first;
  if (vals.size() == 2) {
    cout << M1 - m1 << endl;
    cout << "1 1" << endl;
    return 0;
  }
  int m2 =
      min(vals[0].first + vals[1].first + h, vals[1].first + vals[2].first);
  int M2 = max(vals[0].first + vals[vals.size() - 1].first + h, M1);
  if (M2 - m2 < M1 - m1) {
    cout << M2 - m2 << endl;
    for (int i = 0; i < n; ++i) {
      if (i == vals[0].second) {
        cout << "2 ";
      } else {
        cout << "1 ";
      }
    }
    cout << endl;
  } else {
    cout << M1 - m1 << endl;
    for (int i = 0; i < n; ++i) {
      cout << "1 ";
    }
    cout << endl;
  }
  return 0;
}
