#include <bits/stdc++.h>
using namespace std;
int n, h;
vector<int> a;
int main() {
  scanf("%d %d", &n, &h);
  for (int i = 0; i < n; i++) {
    int k;
    scanf("%d", &k);
    a.push_back(k);
  }
  vector<int> v = a;
  sort(a.begin(), a.end());
  if (n == 2) {
    printf("0\n1 1\n");
  } else {
    int ans1 = a[n - 1] + a[n - 2] - a[0] - a[1];
    int ans2 = max(a[0] + a[n - 1] + h, a[n - 1] + a[n - 2]) -
               min(a[1] + a[2], a[0] + a[1] + h);
    if (ans1 < ans2) {
      printf("%d\n", ans1);
      for (int i = 0; i < n; i++) printf("1 ");
      printf("\n");
    } else {
      printf("%d\n", ans2);
      bool z = 1;
      for (int i = 0; i < n; i++)
        if (v[i] == a[0] && z) {
          printf("1 ");
          z = 0;
        } else
          printf("2 ");
      printf("\n");
    }
  }
}
