#include <bits/stdc++.h>
using namespace std;
struct ele {
  int ith;
  int value;
  int part;
};
ele eles[100010];
int compare1(const void *a, const void *b) {
  return ((ele *)a)->value - ((ele *)b)->value;
}
int compare2(const void *a, const void *b) {
  return ((ele *)a)->ith - ((ele *)b)->ith;
}
int myMax(int a, int b) { return a > b ? a : b; }
int myMin(int a, int b) { return a < b ? a : b; }
int main() {
  int n, h;
  cin >> n >> h;
  for (int i = 0; i < n; i++) {
    cin >> eles[i].value;
    eles[i].ith = i;
    eles[i].part = 2;
  }
  qsort(eles, n, sizeof(ele), compare1);
  int min =
      eles[n - 1].value + eles[n - 2].value - eles[0].value - eles[1].value;
  int p1 = eles[0].value + eles[1].value + h;
  int p2 = eles[1].value + eles[2].value;
  int p3 = eles[n - 1].value + eles[n - 2].value;
  int p4 = eles[n - 1].value + eles[0].value + h;
  int p5 = myMax(p3, p4) - myMin(p1, p2);
  if (p5 < min) {
    min = p5;
    eles[0].part = 1;
  }
  cout << min << endl;
  qsort(eles, n, sizeof(ele), compare2);
  for (int i = 0; i < n; i++) {
    cout << eles[i].part << " ";
  }
  cout << endl;
  return 0;
}
