#include <bits/stdc++.h>
using namespace std;
long long n, h, a[111111], t = 1;
int main() {
  cin >> n >> h;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[t] > a[i]) t = i;
  }
  sort(a + 1, a + n + 1);
  long long ans1 = a[n] + a[n - 1] - a[1] - a[2],
            ans2 = max(a[n] + a[n - 1], a[n] + a[1] + h) -
                   min(a[2] + a[3], a[1] + a[2] + h);
  cout << min(ans1, ans2) << endl;
  if (ans1 <= ans2)
    for (long long i = 1; i <= n; i++) cout << "2 ";
  else {
    for (long long i = 1; i <= n; i++)
      if (i == t)
        cout << "1 ";
      else
        cout << "2 ";
  }
  puts("");
  return 0;
}
