#include <bits/stdc++.h>
#pragma GCC optimize "03"
using namespace std;
const long long int N = 1e5 + 5;
const long long int mod = 1e9 + 7;
const long long int inf = 1e9 + 9;
pair<long long int, long long int> a[N];
long long int p[N];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, h;
  cin >> n >> h;
  for (long long int i = 1; i <= n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a + 1, a + n + 1);
  long long int ans = (a[n].first + a[n - 1].first) - (a[1].first + a[2].first);
  long long int mx =
      max({a[n].first + a[n - 1].first, a[n].first + a[1].first + h});
  long long int mi = a[2].first + a[1].first + h;
  if (n >= 3) mi = min(mi, a[2].first + a[3].first);
  if (ans <= mx - mi) {
    cout << ans << '\n';
    for (long long int i = 1; i <= n; i++) cout << 1 << " ";
  } else {
    cout << mx - mi << '\n';
    for (long long int i = 2; i <= n; i++) p[a[i].second] = 2;
    p[a[1].second] = 1;
    for (long long int i = 1; i <= n; i++) cout << p[i] << " ";
  }
  return 0;
}
