#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, h, flag = 0, n1, pos = 0, max1;
  cin >> n >> h;
  int a[n];
  int i, j;
  for (i = 0; i < n; i++) cin >> a[i];
  n1 = a[0];
  for (i = 1; i < n; i++)
    if (n1 > a[i]) {
      pos = i;
      n1 = a[i];
    }
  sort(a, a + n);
  i = 0;
  int min = a[0] + a[1] + h, max = a[n - 1] + a[n - 2];
  max = (a[0] + a[n - 1] + h > max) ? a[0] + a[n - 1] + h : max;
  j = 0;
  if (n == 2) {
    cout << "0"
         << "\n";
    for (i = 0; i < n; i++)
      cout << "2"
           << " ";
  } else {
    if (min > a[1] + a[2]) min = a[1] + a[2];
    max1 = (a[n - 1] + a[n - 2] > a[0] + a[n - 1]) ? a[n - 1] + a[n - 2]
                                                   : a[0] + a[n - 1];
    if (max > max1 && (max1 - a[0] - a[1] < max - min)) {
      min = a[0] + a[1];
      cout << max1 - min << "\n";
      for (i = 0; i < n; i++)
        cout << "2"
             << " ";
    } else {
      cout << max - min << "\n";
      for (i = 0; i < n; i++)
        if (i == pos)
          cout << "1"
               << " ";
        else
          cout << "2"
               << " ";
    }
  }
  return 0;
}
