#include <bits/stdc++.h>
using namespace std;
signed main() {
  int n, h;
  scanf("%d %d", &n, &h);
  vector<pair<int, int> > v(n);
  vector<int> ans(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &v[i].first);
    v[i].second = i;
  }
  sort(v.begin(), v.end());
  if (n == 2) {
    printf("0\n1 1");
    return 0;
  }
  int ans1 = 1e9;
  for (int i = n - 3; i >= 1; i--) {
    ans1 = min(ans1, max(v[n - 1].first + v[n - 2].first,
                         v[n - 1].first + v[i].first + h) -
                         v[0].first - v[1].first);
  }
  ans1 = min(
      ans1,
      max(v[n - 1].first + v[n - 2].first, v[0].first + v[n - 1].first + h) -
          min(v[1].first + v[2].first, v[1].first + v[0].first + h));
  ans1 = min(ans1,
             max(v[n - 2].first + v[n - 3].first,
                 v[n - 2].first + v[n - 1].first + h) -
                 min(v[0].first + v[n - 1].first + h, v[1].first + v[0].first));
  ans1 = min(ans1, v[n - 1].first + v[n - 2].first - v[0].first - v[1].first);
  printf("%d\n", ans1);
  for (int i = n - 3; i >= 1; i--) {
    if (ans1 ==
        max(v[n - 1].first + v[n - 2].first, v[n - 1].first + v[i].first + h) -
            v[0].first - v[1].first) {
      for (int j = 0; j < i + 1; j++) ans[v[j].second] = 1;
      for (int j = i + 1; j < n; j++) ans[v[j].second] = 2;
      for (int j = 0; j < n; j++) printf("%d ", ans[j]);
      printf("\n");
      return 0;
    }
  }
  if (ans1 ==
      max(v[n - 1].first + v[n - 2].first, v[0].first + v[n - 1].first + h) -
          min(v[1].first + v[2].first, v[1].first + v[0].first + h)) {
    ans[v[0].second] = 1;
    for (int i = 1; i < n; i++) ans[v[i].second] = 2;
    for (int j = 0; j < n; j++) printf("%d ", ans[j]);
    printf("\n");
    return 0;
  }
  if (ans1 ==
      max(v[n - 2].first + v[n - 3].first,
          v[n - 2].first + v[n - 1].first + h) -
          min(v[0].first + v[n - 1].first + h, v[1].first + v[0].first)) {
    for (int i = 0; i < n - 1; i++) ans[v[i].second] = 2;
    ans[v[n - 1].second] = 1;
    for (int j = 0; j < n; j++) printf("%d ", ans[j]);
    printf("\n");
    return 0;
  }
  if (ans1 == v[n - 1].first + v[n - 2].first - v[0].first - v[1].first) {
    for (int i = 0; i < n; i++) ans[v[i].second] = 2;
    for (int j = 0; j < n; j++) printf("%d ", ans[j]);
    printf("\n");
    return 0;
  }
  return 0;
}
