#include <bits/stdc++.h>
using namespace std;
int n, k;
int p[100010];
int x[100010];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  int w = min_element(p, p + n) - p;
  sort(p, p + n);
  if (n == 2) {
    puts("0");
    printf("1 1\n");
    return 0;
  }
  int maxn = max(p[n - 1] + p[n - 2], p[n - 1] + p[0] + k);
  int minn = min(p[0] + p[1] + k, p[1] + p[2]);
  int ans = p[n - 1] + p[n - 2] - p[0] - p[1];
  if (ans <= maxn - minn)
    w = n;
  else
    ans = maxn - minn;
  printf("%d\n", ans);
  for (int i = 0; i < n - 1; i++) printf("%d ", 1 + (i == w));
  printf("%d\n", 1 + ((n - 1) == w));
  return 0;
}
