#include <bits/stdc++.h>
using namespace std;
int II() {
  int q;
  scanf("%d", &q);
  return q;
}
long long LII() {
  long long q;
  scanf("%lld", &q);
  return q;
}
int N, H;
vector<pair<int, int> > v;
int calc() {
  int mi = 1e9, mx = 0;
  for (int i = 1, j = 1; i < N && j <= 5; i++, j++) {
    int q = v[0].first + v[i].first + H;
    mi = min(mi, q);
    mx = max(mx, q);
  }
  for (int i = N - 1, j = 1; i > 0 && j <= 5; i--, j++) {
    int q = v[0].first + v[i].first + H;
    mi = min(mi, q);
    mx = max(mx, q);
  }
  for (int i = 1, j = 1; i < N && j <= 5; i++, j++) {
    for (int k = N - 1, kk = 1; k > 0 && kk <= 5; k--, kk++) {
      if (i >= k) continue;
      int q = v[i].first + v[k].first;
      mi = min(mi, q);
      mx = max(mx, q);
    }
  }
  for (int i = 1, j = 1; i < N && j <= 5; i++, j++) {
    for (int k = i + 1, kk = 1; k < N && kk <= 5; k++, kk++) {
      int q = v[i].first + v[k].first;
      mi = min(mi, q);
      mx = max(mx, q);
    }
  }
  for (int i = N - 1, j = 1; i > 0 && j <= 5; i--, j++) {
    for (int k = i - 1, kk = 1; k > 0 && kk <= 5; k--, kk++) {
      int q = v[i].first + v[k].first;
      mi = min(mi, q);
      mx = max(mx, q);
    }
  }
  return mx - mi;
}
void solve() {
  cin >> N >> H;
  for (int i = 1; i <= N; i++) {
    int q;
    cin >> q;
    v.push_back({q, i});
  }
  sort(v.begin(), v.end());
  int mi1 = v[N - 1].first + v[N - 2].first - (v[0].first + v[1].first);
  int mi2 = calc();
  int br[N + 10];
  if (mi1 < mi2) {
    cout << mi1 << endl;
    for (int i = 1; i <= N; i++) cout << 1 << " ";
    cout << endl;
  } else {
    cout << mi2 << endl;
    br[v[0].second] = 1;
    for (int i = 1; i < N; i++) {
      br[v[i].second] = 2;
    }
    for (int i = 1; i <= N; i++) {
      cout << br[i] << " ";
    }
    cout << endl;
  }
}
int32_t main() {
  int tt;
  tt = 1;
  while (tt--) {
    solve();
  }
}
