#include <bits/stdc++.h>
using namespace std;
const int oo = 2e9, eps = 1e-7, MOD = 998244353;
int n, h, a[100000 + 9], b[100000 + 9];
int main() {
  cin >> n >> h;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  if (n == 2) {
    cout << 0 << endl;
    cout << 1 << " " << 1 << endl;
  } else {
    sort(b, b + n);
    int mn = oo, idx = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] < mn) {
        mn = a[i];
        idx = i;
      }
    }
    int ans1 = abs((b[n - 1] + b[n - 2]) - (b[0] + b[1]));
    int ans2 = abs((b[n - 1] + b[0] + h) - (b[0] + b[1] + h));
    ans2 = max(ans2, abs((b[n - 1] + b[n - 2]) - (b[0] + b[1] + h)));
    ans2 = max(ans2, abs((b[n - 1] + b[0] + h) - (b[1] + b[2])));
    ans2 = max(ans2, abs((b[n - 1] + b[n - 2]) - (b[1] + b[2])));
    if (ans1 <= ans2) {
      cout << ans1 << endl;
      for (int i = 0; i < n; i++) {
        cout << 2 << " ";
      }
    } else {
      cout << ans2 << endl;
      for (int i = 0; i < n; i++) {
        if (i == idx) {
          cout << 1 << " ";
        } else {
          cout << 2 << " ";
        }
      }
    }
  }
  return 0;
}
