#include <bits/stdc++.h>
using namespace std;
int n, h;
pair<int, int> a[100005];
int main() {
  cin >> n >> h;
  int i, j, mx1, mx2, mn1, mn2;
  for ((i) = 0; (i) < (n); (i)++) {
    scanf("%d", &a[i].first);
    a[i].second = i;
  }
  sort(a, a + n);
  mx1 = max(a[n - 1].first + a[n - 2].first, a[0].first + a[n - 1].first + h);
  mn1 = a[0].first + a[1].first + h;
  if (n > 2) mn1 = min(mn1, a[1].first + a[2].first);
  mx2 = a[n - 1].first + a[n - 2].first;
  mn2 = a[0].first + a[1].first;
  if (mx1 - mn1 < mx2 - mn2)
    a[0].first = 1;
  else
    a[0].first = 2;
  swap(a[0].first, a[0].second);
  for (i = 1; i < n; i++) {
    swap(a[i].first, a[i].second);
    a[i].second = 2;
  }
  sort(a, a + n);
  printf("%d\n", min(mx2 - mn2, mx1 - mn1));
  for ((i) = 0; (i) < (n - 1); (i)++) printf("%d ", a[i].second);
  printf("%d\n", a[n - 1].second);
  return 0;
}
