#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, h;
  cin >> n >> h;
  vector<pair<int, int>> A(n);
  for (int i = 0; i < n; i++) {
    cin >> A[i].first;
    A[i].second = i;
  }
  if (n == 2) {
    cout << 0 << "\n";
    cout << "1 1\n";
    return 0;
  }
  sort(A.begin(), A.end());
  int a = A[n - 1].first + A[n - 2].first - (A[0].first + A[1].first);
  int b = abs(
      max(A[n - 1].first + A[n - 2].first, A[0].first + A[n - 1].first + h) -
      min(A[1].first + A[2].first, (A[0].first + A[1].first + h)));
  cout << min(a, b) << "\n";
  if (a < b) {
    for (int i = 0; i < n; i++) cout << 2 << " ";
  } else {
    for (int i = 0; i < n; i++) {
      if (A[0].second == i)
        cout << "1 ";
      else
        cout << "2 ";
    }
  }
}
