#include <bits/stdc++.h>
long long int mod = 1000000000 + 7;
long long int inf = (long long int)(5e18);
using namespace std;
mt19937 unlucko(chrono::steady_clock::now().time_since_epoch().count());
int main() {
  iostream::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, h;
  cin >> n >> h;
  vector<int> a(n), ans(n, 1), newa;
  int mins = mod;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mins = min(a[i], mins);
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == mins) {
      ans[i] = 2;
      break;
    }
  }
  sort(a.begin(), a.end());
  if (n == 2)
    cout << "0\n1 1";
  else {
    if (max(a[n - 1] + a[n - 2], a[n - 1] + h + mins) -
            min(a[1] + a[2], a[1] + mins + h) <=
        a[n - 1] + a[n - 2] - a[0] - a[1]) {
      cout << max(a[n - 1] + a[n - 2], a[n - 1] + h + mins) -
                  min(a[1] + a[2], a[1] + mins + h)
           << "\n";
      for (auto it : ans) cout << it << " ";
    } else {
      cout << a[n - 1] + a[n - 2] - a[0] - a[1] << "\n";
      for (int i = 0; i < n; i++) cout << "1 ";
    }
  }
}
