#include <bits/stdc++.h>
using namespace std;
long long fpm(long long a, long long b, long long p) {
  long long w = 1;
  for (; b; b >>= 1, a = a * a % p) b& 1 ? w = w * a % p : 0;
  w;
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
template <class T>
inline bool maxit(T& a, T b) {
  return b > a ? a = b, true : false;
}
template <class T>
inline bool minit(T& a, T b) {
  return b < a ? a = b, true : false;
}
const int Sn = 100010, inf = (int)1e9;
int n, h;
int A[Sn], ls[Sn];
int temp, gemp;
int Ans[Sn];
bool cmp(const int& i, const int& j) { return A[i] < A[j]; }
int main() {
  cin >> n >> h;
  for (int i = 1; i <= n; i++) {
    cin >> A[i];
    ls[i] = i;
  }
  sort(ls + 1, ls + n + 1, cmp);
  for (int i = 1; i <= n; i++) Ans[ls[i]] = 2;
  temp = max(A[ls[1]] + A[ls[n]] + h, A[ls[n - 1]] + A[ls[n]]) -
         min(A[ls[1]] + A[ls[2]] + h, (n < 3 ? inf : A[ls[2]] + A[ls[3]]));
  gemp = (A[ls[n - 1]] + A[ls[n]]) - (A[ls[1]] + A[ls[2]]);
  if (temp < gemp) Ans[ls[1]] = 1;
  printf("%d\n", min(temp, gemp));
  for (int i = 1; i <= n; i++) printf("%d ", Ans[i]);
}
