#include <bits/stdc++.h>
using namespace std;
int goodness(vector<pair<int, int> >& v, int split, int h) {
  int mi = 999999999;
  int ma = 0;
  if (split > 1) {
    mi = v[0].first + v[1].first;
  } else if (split < v.size() - 1) {
    mi = v[split].first + v[split + 1].first;
  }
  if (split < v.size() - 1) {
    ma = v[v.size() - 1].first + v[v.size() - 2].first;
  } else if (split > 1) {
    ma = v[split - 2].first + v[split - 1].first;
  }
  if (split < v.size()) mi = min(mi, v[0].first + v[split].first + h);
  if (split > 0) ma = max(ma, v[split - 1].first + v[v.size() - 1].first + h);
  return ma - mi;
}
int main() {
  int n, h;
  scanf("%d %d", &n, &h);
  vector<pair<int, int> > values;
  int part[n];
  for (int i = 0; i < n; i++) {
    part[i] = 0;
    int v;
    scanf("%d", &v);
    values.push_back(make_pair(v, i));
  }
  sort(values.begin(), values.end());
  int bestSplit = 0;
  int bestSplitGoodness = 999999999;
  for (int i = 0; i < n; i++) {
    int temp = goodness(values, i, h);
    if (temp < bestSplitGoodness) {
      bestSplit = i;
      bestSplitGoodness = temp;
    }
  }
  for (int i = 0; i < n; i++) {
    part[values[i].second] = (i < bestSplit) ? 1 : 2;
  }
  printf("%d\n", bestSplitGoodness);
  bool first = true;
  for (int j = 0; j < n; j++) {
    if (first) {
      printf("%d", part[j]);
      first = false;
    } else {
      printf(" %d", part[j]);
    }
  }
  printf("\n");
  return 0;
}
