#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:200000000")
using namespace std;
template <typename T>
inline T Abs(T x) {
  return (x >= 0) ? x : -x;
}
template <typename T>
inline T sqr(T x) {
  return x * x;
}
template <typename T>
string toStr(T x) {
  stringstream st;
  st << x;
  string s;
  st >> s;
  return s;
}
const int INF = (int)1E9;
const long long INF64 = (long long)1E18;
const long double EPS = 1E-9;
const long double PI = 3.1415926535897932384626433832795;
const int MAXN = 100100;
pair<long long, int> p[MAXN], s[MAXN];
pair<long long, int> a[MAXN];
long long h, ANS;
int n, ans[MAXN];
long long calcByMask() {
  vector<long long> A, B;
  for (int i = 0; i < (int)(n); i++) {
    if (ans[i] == 0) A.push_back(a[i].first);
    if (ans[i] == 1) B.push_back(a[i].first);
  }
  long long minv = INF64;
  if (A.size() >= 2) minv = min(minv, A[0] + A[1]);
  if (B.size() >= 2) minv = min(minv, B[0] + B[1]);
  if (!A.empty() && !B.empty()) minv = min(minv, A[0] + B[0] + h);
  reverse((A).begin(), (A).end());
  reverse((B).begin(), (B).end());
  long long maxv = -INF64;
  if (A.size() >= 2) maxv = max(maxv, A[0] + A[1]);
  if (B.size() >= 2) maxv = max(maxv, B[0] + B[1]);
  if (!A.empty() && !B.empty()) maxv = max(maxv, A[0] + B[0] + h);
  return maxv - minv;
}
void printAnswer() {
  cout << ANS << endl;
  vector<int> res(n);
  for (int i = 0; i < (int)(n); i++) res[a[i].second] = ans[i];
  for (int i = 0; i < (int)(n); i++) cout << res[i] + 1 << " ";
  cout << endl;
  exit(0);
}
long long solveByMask(bool print) {
  long long res = INF64;
  for (int mask1 = 0; mask1 < (int)(4); mask1++)
    for (int mask2 = 0; mask2 < (int)(4); mask2++) {
      for (int i = 0; i < (int)(2); i++)
        if ((mask1 & (1 << i)) != 0) ans[i] = 1;
      for (int i = 0; i < (int)(2); i++)
        if ((mask2 & (1 << i)) != 0) ans[n - i - 1] = 1;
      long long cur = calcByMask();
      if (print && cur == ANS) printAnswer();
      res = min(res, cur);
      ans[0] = ans[1] = ans[n - 1] = ans[n - 2] = 0;
    }
  return res;
}
long long solveByCalc(bool print) {
  for (int i = 0; i < (int)(n); i++) {
    p[i] = make_pair(-INF64, -1);
    s[i] = make_pair(+INF64, -1);
  }
  int i0 = 0, i1 = 1, i2 = 2;
  for (int i = 3; i < n; i++) {
    p[i] = p[i - 1];
    {
      long long cur =
          min(a[i0].first + a[i].first,
              min(a[i1].first + a[i2].first, a[i0].first + a[i1].first + h));
      p[i] = max(p[i], make_pair(cur, i));
    }
    {
      long long cur =
          min(a[i0].first + a[i2].first,
              min(a[i1].first + a[i].first, a[i0].first + a[i1].first + h));
      p[i] = max(p[i], make_pair(cur, i));
    }
  }
  i0 = n - 1;
  i1 = n - 2;
  i2 = n - 3;
  for (int i = n - 4; i >= 0; i--) {
    s[i] = s[i + 1];
    {
      long long cur =
          max(a[i0].first + a[i].first,
              max(a[i1].first + a[i2].first, a[i0].first + a[i1].first + h));
      s[i] = min(s[i], make_pair(cur, i));
    }
    {
      long long cur =
          max(a[i0].first + a[i2].first,
              max(a[i1].first + a[i].first, a[i0].first + a[i1].first + h));
      s[i] = min(s[i], make_pair(cur, i));
    }
  }
  long long res = INF64;
  for (int i = 0; i < (int)(n); i++) {
    res = min(res, s[i].first - p[i].first);
    if (res == ANS && print) {
      {
        int j = p[i].second;
        i0 = 0, i1 = 1, i2 = 2;
        if (p[j].first ==
            min(a[i0].first + a[j].first, min(a[i1].first + a[i2].first,
                                              a[i0].first + a[i1].first + h))) {
          ans[i0] = 1;
          ans[j] = 1;
        } else if (p[j].first == min(a[i0].first + a[i2].first,
                                     min(a[i1].first + a[j].first,
                                         a[i0].first + a[i1].first + h))) {
          ans[i1] = 1;
          ans[j] = 1;
        } else
          throw;
      }
      {
        int j = s[i].second;
        i0 = n - 1, i1 = n - 2, i2 = n - 3;
        if (s[j].first ==
            min(a[i0].first + a[j].first, min(a[i1].first + a[i2].first,
                                              a[i0].first + a[i1].first + h))) {
          ans[i0] = 1;
          ans[j] = 1;
        } else if (s[j].first == min(a[i0].first + a[i2].first,
                                     min(a[i1].first + a[j].first,
                                         a[i0].first + a[i1].first + h))) {
          ans[i1] = 1;
          ans[j] = 1;
        } else
          throw;
      }
      printAnswer();
    }
  }
  return res;
}
int main() {
  cin >> n >> h;
  for (int i = 0; i < (int)(n); i++) {
    scanf("%I64d", &a[i].first);
    a[i].second = i;
  }
  sort(a, a + n);
  int best = -1;
  long long ans = INF64;
  {
    long long cur = solveByMask(false);
    if (cur < ans) {
      ans = cur;
      best = 1;
    }
  }
  {
    long long cur = solveByCalc(false);
    if (cur < ans) {
      ans = cur;
      best = 2;
    }
  }
  ANS = ans;
  if (best == 1) solveByMask(true);
  if (best == 2) solveByCalc(true);
  return 0;
}
