#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > a;
int ans[100100];
int main() {
  int n, h;
  scanf("%d%d", &n, &h);
  a.resize(n);
  for (int i = (0); i < (n); ++i) {
    a[i].second = i;
    scanf("%d", &a[i].first);
  }
  sort(a.begin(), a.end());
  int res1 =
      a[a.size() - 1].first + a[a.size() - 2].first - a[0].first - a[1].first;
  int res2 = 2000000000;
  if (a.size() > 2) {
    int min1 = 2000000000, max1 = -2000000000;
    min1 = ((a[0].first + a[1].first + h < min1) ? (a[0].first + a[1].first + h)
                                                 : (min1));
    min1 =
        ((a[2].first + a[1].first < min1) ? (a[2].first + a[1].first) : (min1));
    max1 = ((a[a.size() - 1].first + a[0].first + h < max1)
                ? (max1)
                : (a[a.size() - 1].first + a[0].first + h));
    max1 = ((a[a.size() - 1].first + a[a.size() - 2].first < max1)
                ? (max1)
                : (a[a.size() - 1].first + a[a.size() - 2].first));
    res2 = max1 - min1;
  }
  printf("%d\n", ((res1 < res2) ? (res1) : (res2)));
  if (res2 < res1) ans[a[0].second] = 1;
  for (int i = (0); i < (n); ++i) {
    if (i) printf(" ");
    printf("%d", ans[i] + 1);
  }
  printf("\n");
}
