#include <bits/stdc++.h>
using namespace std;
int n, a[100500], h;
pair<int, int> b[100500];
int bestans = 1e9;
int res;
int main() {
  scanf("%d%d", &n, &h);
  for (int i = 0; i < n; ++i)
    scanf("%d", &b[i].first), b[i].second = i, a[i] = 1;
  res = n;
  sort(b, b + n);
  bestans = b[n - 1].first + b[n - 2].first - b[0].first - b[1].first;
  for (int i = 1; i < n; ++i) {
    int mn =
        b[0].first + min(b[i].first + h, ((i != 1) ? (b[1].first) : (int)1e9));
    if (i <= n - 2) mn = min(mn, b[i].first + b[i + 1].first);
    int mx =
        b[n - 1].first + max(((n - 2 >= i) ? (b[n - 2].first) : ((int)-1e9)),
                             b[i - 1].first + h);
    if (i > 1) mx = max(mx, b[i - 1].first + b[i - 2].first);
    if (mx - mn < bestans) res = i, bestans = mx - mn;
  }
  for (int i = n - 1; i >= res; --i) a[b[i].second] = 2;
  cout << bestans << endl;
  for (int i = 0; i < n; ++i) cout << a[i] << ' ';
}
