#include <bits/stdc++.h>
using namespace std;
int n, i, h, a[100000], x, col[100000];
pair<int, int> b[100000];
int main() {
  cin >> n >> h;
  for (i = 0; i < n; i++) {
    cin >> b[i].first;
    b[i].second = i;
  }
  sort(b, b + n);
  if (n == 2) {
    cout << 0 << endl;
    cout << 1 << " " << 2 << endl;
    return 0;
  }
  int ansdif = b[n - 1].first + b[n - 2].first - (b[0].first + b[1].first);
  int ansnew =
      max(b[n - 1].first + b[n - 2].first, b[n - 1].first + b[0].first + h) -
      min(b[0].first + b[1].first + h, b[1].first + b[2].first);
  if (ansdif > ansnew) {
    cout << ansnew << endl;
    for (i = 0; i < n; i++) {
      if (i == b[0].second)
        cout << 1 << " ";
      else
        cout << 2 << " ";
    }
  } else {
    cout << ansdif << endl;
    for (i = 0; i < n; i++) cout << 2 << " ";
  }
  return 0;
}
