#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
int N, h;
pair<int, int> ar[MAXN];
bool col[MAXN];
int main() {
  cin >> N >> h;
  for (int i = 1; i <= N; i++) {
    int a;
    scanf(" %d", &a);
    ar[i] = pair<int, int>(a, i);
  }
  sort(ar + 1, ar + 1 + N);
  pair<int, int> ans = pair<int, int>(0x7fffffff, 0);
  ans = min(
      ans, pair<int, int>(
               ar[N].first + ar[N - 1].first - (ar[1].first + ar[2].first), 1));
  ans = min(
      ans,
      pair<int, int>(
          max(ar[N].first + ar[N - 1].first, ar[1].first + ar[N].first + h) -
              min((ar[1].first + ar[2].first + h), (ar[2].first + ar[3].first)),
          2));
  for (int i = 3; i < N - 1; i++) {
    int x = max(ar[i].first + ar[N].first + h, ar[N].first + ar[N - 1].first);
    int y = min(ar[i + 1].first + ar[i + 2].first, ar[1].first + ar[2].first);
    y = min(ar[1].first + ar[i + 1].first + h, y);
    ans = min(ans, pair<int, int>(x - y, i));
  }
  cout << ans.first << endl;
  for (int i = ans.second; i <= N; i++) col[ar[i].second] = 1;
  for (int i = 1; i <= N; i++) printf("%d ", col[i] + 1);
  return 0;
}
