#include <bits/stdc++.h>
using namespace std;
long long modExp(long long x, long long n, long long M) {
  long long result = 1;
  while (n > 0) {
    if (n % 2 == 1) result = (result * x) % M;
    x = (x * x) % M;
    n = n / 2;
  }
  return result;
}
void solve() {
  long long n, h;
  cin >> n >> h;
  long long a[n];
  vector<pair<long long, long long>> v;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    v.push_back(make_pair(a[i], i));
  }
  if (n == 2) {
    cout << "0\n1 1";
    return;
  }
  sort(v.begin(), v.end());
  long long x = v[1].first + v[0].first;
  long long y = v[n - 1].first + v[n - 2].first;
  long long mi = y - x;
  long long p = min(v[2].first + v[1].first, v[1].first + v[0].first + h);
  long long q =
      max(v[n - 1].first + v[n - 2].first, v[n - 1].first + v[0].first + h);
  long long ma = q - p;
  if (mi <= ma) {
    cout << mi << endl;
    for (long long i = 0; i < n; i++) cout << "1 ";
  } else {
    cout << ma << endl;
    vector<long long> ans(n, 1);
    ans[v[0].second] = 2;
    for (long long i = 0; i < n; i++) cout << ans[i] << " ";
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
}
