#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, h;
  cin >> n >> h;
  long long a[n];
  long long mini = 1000000000000000000;
  long long ind = -1;
  for (long long i = 0, _n = (n); i < _n; i++) {
    cin >> a[i];
    if (a[i] < mini) {
      mini = a[i];
      ind = i;
    }
  }
  sort(a, a + n);
  if (n == 2) {
    cout << "0" << endl;
    cout << "1 1" << endl;
    return 0;
  }
  long long max1 = a[n - 1];
  long long max2 = a[n - 2];
  long long min1 = a[0];
  long long min2 = a[1];
  long long min3 = a[2];
  long long first = 0;
  long long second = 0;
  first = max1 + max2 - min1 - min2;
  long long one = max(max1 + max2, max1 + min1 + h);
  long long two = min(min1 + min2 + h, min2 + min3);
  second = one - two;
  long long ans = min(first, second);
  cout << ans << endl;
  if (ans == first) {
    for (long long i = 0, _n = (n); i < _n; i++) {
      cout << "1 ";
    }
    cout << endl;
  } else {
    for (long long i = 0, _n = (n); i < _n; i++) {
      if (i == ind)
        cout << "2 ";
      else
        cout << "1 ";
    }
    cout << endl;
  }
}
