#include <bits/stdc++.h>
using namespace std;
typedef struct type {
  int val;
  int idx;
} type;
int compare(const type& a, const type& b) {
  if (a.val == b.val) return a.idx < b.idx;
  return a.val < b.val;
}
type a[100001];
int ans[100001];
int main() {
  int n, h;
  scanf("%d", &n);
  scanf("%d", &h);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i].val);
    a[i].idx = i;
  }
  if (n == 2) {
    printf("0\n");
    printf("1 1\n");
    return 0;
  }
  sort(a, a + n, compare);
  long long int ans1 = ((a[n - 1].val + a[n - 2].val) - (a[0].val + a[1].val));
  long long int max1 =
      max(a[n - 1].val + a[n - 2].val, a[n - 1].val + a[0].val + h);
  long long int min1 = min(a[1].val + a[0].val + h, a[1].val + a[2].val);
  long long int val1 = max1 - min1;
  if (ans1 < val1) {
    for (int i = 0; i < n; i++) {
      ans[i] = 1;
    }
  } else {
    for (int i = 0; i < n; i++) ans[i] = 1;
    ans[a[0].idx] = 2;
  }
  printf("%lld\n", min(ans1, val1));
  for (int i = 0; i < n; i++) printf("%d ", ans[i]);
  printf("\n");
}
