#include <bits/stdc++.h>
using namespace std;
const double PI = 2.0 * acos(0.0);
const double EPS = 1e-7;
struct data {
  int idx;
  int num;
  inline bool operator<(const data &d) const {
    if (num != d.num) return num < d.num;
    return idx < d.idx;
  }
};
bool compare(data a, data b) { return a.idx < b.idx; }
data arr[100005];
int main() {
  int n, h;
  scanf("%d %d", &n, &h);
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i].num);
    arr[i].idx = i;
  }
  sort(arr, arr + n);
  int min_idx = arr[0].idx;
  int summ = arr[n - 1].num + arr[n - 2].num - arr[0].num - arr[1].num;
  int maxx =
      max(arr[n - 1].num + arr[n - 2].num, arr[0].num + arr[n - 1].num + h);
  int minn = min(arr[0].num + arr[1].num + h, arr[1].num + arr[2].num);
  if (summ <= maxx - minn) {
    printf("%d\n", summ);
    printf("%d", 2);
    for (int i = 1; i < n; i++) printf(" %d", 2);
  } else {
    printf("%d\n", maxx - minn);
    sort(arr, arr + n, compare);
    for (int i = 0; i < n; i++)
      printf("%s%d", i == 0 ? "" : " ", i == min_idx ? 1 : 2);
  }
  puts("");
  return 0;
}
