#include <bits/stdc++.h>
using namespace std;
int n, h;
int arr[1000010];
int main() {
  cin >> n >> h;
  if (n == 2) {
    cout << 0 << endl;
    cout << "1 1";
    return 0;
  }
  int index = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i] < arr[index]) {
      index = i;
    }
  }
  sort(arr, arr + n);
  bool move = false;
  int diff = (arr[n - 1] + arr[n - 2] - arr[0] - arr[1]);
  int am = abs(arr[0] + arr[1] + h - arr[n - 1] - arr[n - 2]);
  am = max(am, arr[n - 1] + arr[n - 2] - arr[1] - arr[2]);
  am = max(am, abs(arr[0] + arr[n - 1] + h - arr[1] - arr[2]));
  if (diff > am) {
    move = true;
    diff = am;
  }
  cout << diff << endl;
  for (int i = 0; i < n; i++) {
    if (move && i == index) {
      cout << "2 ";
    } else {
      cout << "1 ";
    }
  }
  return 0;
}
