#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long int h;
  cin >> n >> h;
  long long int seq[n], ary[n];
  for (int i = 0; i < n; i++) {
    cin >> seq[i];
    ary[i] = seq[i];
  }
  if (n == 2) {
    cout << 0 << endl << 1 << " " << 1 << endl;
    return 0;
  }
  sort(seq, seq + n);
  int ans1 = seq[n - 1] + seq[n - 2] - (seq[0] + seq[1]);
  int ans2 = max(seq[n - 1] + seq[n - 2], seq[0] + seq[n - 1] + h) -
             min(seq[0] + seq[1] + h, seq[1] + seq[2]);
  if (ans1 < ans2) {
    cout << ans1 << endl;
    for (int i = 0; i < n; i++) cout << 1 << " ";
  } else {
    cout << ans2 << endl;
    bool flag = false;
    for (int i = 0; i < n; i++) {
      if (ary[i] == seq[0] && !flag)
        cout << 1 << " ", flag = true;
      else
        cout << 2 << " ";
    }
  }
}
