#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > SortedList;
int ans[100001];
int main() {
  int n, h;
  scanf("%d%d", &n, &h);
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    SortedList.push_back(make_pair(a, i));
  }
  sort(SortedList.begin(), SortedList.end());
  for (int i = 0; i < SortedList.size(); i++) ans[SortedList[i].second] = 1;
  if (n == 2) {
    cout << 0 << endl << 1 << " " << 1 << "\n";
    return 0;
  }
  int Max1 = max(SortedList.back().first + SortedList[n - 2].first,
                 SortedList[0].first + h + SortedList.back().first);
  int Min1 = min(SortedList[1].first + SortedList[2].first,
                 SortedList[0].first + h + SortedList[1].first);
  int Max2 = SortedList[n - 1].first + SortedList[n - 2].first;
  int Min2 = SortedList[0].first + SortedList[1].first;
  int ans1 = Max2 - Min2;
  if (Max1 - Min1 < Max2 - Min2)
    ans[SortedList[0].second] = 2, ans1 = Max1 - Min1;
  printf("%d\n", ans1);
  for (int i = 0; i < n; i++) printf("%d%c", ans[i], " \n"[i == n - 1]);
  return 0;
}
