#include <bits/stdc++.h>
using namespace std;
int n, h, x, pp = -1, ans = 1000000000;
pair<int, int> a[111111];
int askminn(int i) {
  int minn = 1000000000;
  if (i > 1) minn = min(minn, a[0].first + a[1].first);
  if (i) minn = min(minn, a[0].first + a[i].first + h);
  if (i + 1 < n) minn = min(minn, a[i].first + a[i + 1].first);
  return minn;
}
int askmaxn(int i) {
  int maxn = 0;
  if (i + 1 < n) maxn = max(maxn, a[n - 2].first + a[n - 1].first);
  if (i) maxn = max(maxn, a[i - 1].first + a[n - 1].first + h);
  return maxn;
}
int main() {
  scanf("%d%d", &n, &h);
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    a[i] = make_pair(x, i);
  }
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    int minn = askminn(i);
    int maxn = askmaxn(i);
    if (maxn - minn < ans) {
      ans = maxn - minn;
      pp = i;
    }
  }
  printf("%d\n", ans);
  for (int i = 0; i < pp; i++) {
    a[i].first = a[i].second;
    a[i].second = 1;
  }
  for (int i = pp; i < n; i++) {
    a[i].first = a[i].second;
    a[i].second = 2;
  }
  sort(a, a + n);
  for (int i = 0; i < n; i++) printf("%d ", a[i].second);
  printf("\n");
  return 0;
}
