#include <bits/stdc++.h>
using namespace std;
const int N = 100002;
int n, h, ans[N];
pair<int, int> a[N];
int main() {
  scanf("%d%d", &n, &h);
  for (int i = (1); i <= (int)(n); ++i)
    scanf("%d", &a[i].first), a[i].second = i;
  sort(a + 1, a + 1 + n);
  int mn = 1000000000, index;
  for (int i = (0); i <= (int)(n); ++i) {
    int curMx = 0;
    if (i and i < n) curMx = a[i].first + a[n].first + h;
    if (i > 1) curMx = max(curMx, a[i].first + a[i - 1].first);
    if (i < n - 1) curMx = max(curMx, a[n - 1].first + a[n].first);
    int curMn = 1000000000;
    if (i and i < n) curMn = a[1].first + a[i + 1].first + h;
    if (i > 1) curMn = min(curMn, a[1].first + a[2].first);
    if (i < n - 1) curMn = min(curMn, a[i + 1].first + a[i + 2].first);
    if (curMx - curMn < mn) mn = curMx - curMn, index = i;
  }
  cout << (mn) << endl;
  for (int i = (1); i <= (int)(n); ++i) ans[a[i].second] = i > index ? 2 : 1;
  for (int i = (1); i <= (int)(n); ++i) printf("%d ", ans[i]);
}
