#include <bits/stdc++.h>
using namespace std;
void err(istringstream &iss) {}
template <typename T, typename... Args>
void err(istringstream &iss, const T &varVal, const Args &...args) {
  string varName;
  iss >> varName;
  if (varName.back() == ',') varName.back() = ' ';
  cout << varName << " = " << varVal << "; ", err(iss, args...);
}
int n, m, K, T, Q, cn;
int h, ans[100005];
pair<int, int> a[100005];
int main() {
  cin.tie(NULL);
  scanf("%d%d", &n, &h);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i].first), a[i].second = i;
  }
  sort(a, a + n);
  int mn = 1000000007, lst = -1;
  for (int i = 0; i < n; i++) {
    int sameMx = ((i < n - 2) ? a[n - 2].first + a[n - 1].first
                              : ((i > 0) ? a[i].first + a[i - 1].first : 0));
    int sameMn =
        ((i > 0) ? a[0].first + a[1].first
                 : ((i < n - 2) ? a[i + 2].first + a[i + 1].first : 0));
    int oppMx = ((i == n - 1) ? 0 : a[i].first + a[n - 1].first + h),
        oppMn = ((i == n - 1) ? 0 : a[0].first + a[i + 1].first + h);
    int diffMx = max(abs(sameMx - sameMn), abs(oppMx - oppMn));
    if (i != n - 1)
      diffMx = max(diffMx, max(abs(sameMx - oppMn), abs(sameMn - oppMx)));
    if (diffMx < mn) mn = diffMx, lst = i;
  }
  for (int i = 0; i <= lst; i++) {
    ans[a[i].second] = 1;
  }
  for (int i = lst + 1; i <= n - 1; i++) {
    ans[a[i].second] = 2;
  }
  printf("%d\n", mn);
  for (int i = 0; i < n; i++) {
    printf("%d", ans[i]), printf("%c", " \n"[i == n - 1]);
  }
  return 0;
}
