#include <bits/stdc++.h>
using namespace std;
pair<int, int> a[100005];
int n;
int ans[100005];
int main() {
  int h;
  cin >> n >> h;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a, a + n);
  fill(ans, ans + n, 2);
  if (n < 3) {
    cout << 0 << endl;
    return 0 * puts("2 2");
  }
  int ret = a[n - 1].first + a[n - 2].first - a[0].first - a[1].first;
  int mx =
      max(a[n - 1].first + a[n - 2].first, a[0].first + a[n - 1].first + h);
  int mn = min(a[0].first + a[1].first + h, a[1].first + a[2].first);
  if (mx - mn < ret) ret = mx - mn, ans[a[0].second] = 1;
  cout << ret << '\n';
  for (int i = 0; i < n; i++) cout << ans[i] << ' ';
  return 0;
}
