#include <bits/stdc++.h>
using namespace std;
const int INF = (1 << 30) - 1;
const long double EPS = 1e-9;
const long double PI = fabs(atan2(0.0, -1.0));
int n, h;
int a[100005];
void load() {
  scanf("%d%d", &n, &h);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
}
inline bool cmp(int i, int j) { return a[i] < a[j]; }
inline int count(int prefix, const vector<int> &p) {
  vector<int> left, right;
  for (int i = 0; i < n; i++) {
    if (i < prefix)
      left.push_back(a[p[i]]);
    else
      right.push_back(a[p[i]]);
  }
  sort(left.begin(), left.end());
  sort(right.begin(), right.end());
  int mn = INF;
  int mx = -INF;
  if (left.size() > 1) {
    mn = min(mn, left[0] + left[1]);
    mx = max(mx, left.back() + left[(int)left.size() - 2]);
  }
  if (right.size() > 1) {
    mn = min(mn, right[0] + right[1]);
    mx = max(mx, right.back() + right[(int)right.size() - 2]);
  }
  if (!left.empty() && !right.empty()) {
    mn = min(mn, left[0] + right[0] + h);
    mx = max(mx, left.back() + right.back() + h);
  }
  return mx - mn;
}
void solve() {
  vector<int> p(n);
  for (int i = 0; i < n; i++) p[i] = i;
  sort(p.begin(), p.end(), cmp);
  int best = INF;
  int bestPrefix = -1;
  for (int prefix = 0; prefix < min(n, 10); prefix++) {
    int cur = count(prefix, p);
    if (cur < best) {
      best = cur;
      bestPrefix = prefix;
    }
  }
  printf("%d\n", best);
  vector<int> answer(n, 0);
  for (int i = 0; i < n; i++) answer[p[i]] = i < bestPrefix ? 1 : 2;
  for (int i = 0; i < n; i++) {
    if (i > 0) printf(" ");
    printf("%d", answer[i]);
  }
}
int main() {
  load();
  solve();
  return 0;
}
