#include <bits/stdc++.h>
using namespace std;
int n, h, res1, res2, mi, mx, mn;
int ar[100005];
int main() {
  cin >> n >> h;
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
    if (ar[i] < ar[mi]) mi = i;
  }
  sort(ar, ar + n);
  res1 = ar[n - 1] + ar[n - 2] - (ar[1] + ar[0]);
  mx = max(ar[n - 1] + ar[0] + h, (n > 2) ? ar[n - 2] + ar[n - 1] : 0);
  mn = min(ar[0] + ar[1] + h, (n > 2) ? ar[1] + ar[2] : (int)1e9);
  res2 = mx - mn;
  cout << min(res1, res2) << '\n';
  for (int i = 0; i < n; i++) cout << (i == mi & (res2 < res1)) * 1 + 1 << ' ';
  return 0;
}
