#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> a[1000000];
int xxx[1000000];
long long n, h;
int main() {
  cin >> n >> h;
  for (long long i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a, a + n);
  long long best = 1000000000;
  long long id;
  long long mx, mn;
  long long a1, a2, a3, a4, a5;
  for (long long i = 0; i <= n; i++) {
    if (i == 0) {
      mn = a[0].first + a[1].first;
      mx = a[n - 2].first + a[n - 1].first;
      if (mx - mn < best) {
        best = mx - mn;
        id = i;
      }
    } else if (i == 1) {
      mn = a[0].first + a[1].first + h;
      if (2 < n) mn = min(mn, a[1].first + a[2].first);
      long long one = a[0].first + a[n - 1].first + h;
      long long two = a[n - 1].first + a[n - 2].first;
      mx = max(one, two);
      if (mx - mn < best) {
        best = mx - mn;
        id = i;
      }
    } else if (i == n - 1) {
      mn = a[0].first + a[1].first;
      mx = a[n - 1].first + a[n - 2].first + h;
      if (mx - mn < best) {
        best = mx - mn;
        id = i;
      }
    } else if (i == n - 2) {
      mn = a[0].first + a[1].first;
      long long one = a[n - 3].first + a[n - 1].first + h;
      long long two = a[n - 1].first + a[n - 2].first;
      mx = max(one, two);
      if (mx - mn < best) {
        best = mx - mn;
        id = i;
      }
    } else {
      mn = a[0].first + a[1].first;
      long long one = a[i - 1].first + a[n - 1].first + h;
      long long two = a[n - 1].first + a[n - 2].first;
      mx = max(one, two);
      if (mx - mn < best) {
        best = mx - mn;
        id = i;
      }
    }
  }
  cout << best << endl;
  for (int i = 0; i < n; i++) {
    if (i < id)
      xxx[a[i].second] = 1;
    else
      xxx[a[i].second] = 2;
  }
  for (int i = 0; i < n; i++) {
    cout << (i == 0 ? "" : " ") << xxx[i];
  }
  cout << endl;
  return 0;
}
