#include <bits/stdc++.h>
using namespace std;
long long n, h;
pair<long long, long long> a[100010];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  cin >> n >> h;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  if (n == 2) {
    cout << "0" << endl;
    cout << "1 1";
    return 0;
  }
  sort(a + 1, a + 1 + n);
  long long c1 = (a[n].first + a[n - 1].first) - (a[2].first + a[1].first);
  long long c2 = max(a[n].first + a[n - 1].first, a[1].first + a[n].first + h) -
                 min(a[3].first + a[2].first, a[2].first + a[1].first + h);
  if (c1 <= c2) {
    cout << c1 << endl;
    for (int i = 1; i <= n; i++) cout << "1 ";
  } else {
    cout << c2 << endl;
    for (int i = 1; i <= n; i++)
      if (i == a[1].second)
        cout << "1 ";
      else
        cout << "2 ";
  }
  return 0;
}
