#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> nums, oNums;
  int n, h, x, minVal, maxVal, minGoodness;
  bool change = false;
  cin >> n >> h;
  for (int i = 0; i < n; i++) {
    cin >> x;
    nums.push_back(x);
    oNums.push_back(x);
  }
  sort(nums.begin(), nums.end());
  minVal = nums[0] + nums[1];
  maxVal = nums[nums.size() - 1] + nums[nums.size() - 2];
  minGoodness = maxVal - minVal;
  if (n == 2) {
    cout << minGoodness << endl;
    cout << "1 1" << endl;
    return 0;
  }
  if (max(maxVal, nums[nums.size() - 1] + nums[0] + h) -
          min(nums[0] + nums[1] + h, nums[1] + nums[2]) <
      minGoodness) {
    change = true;
    minGoodness = max(maxVal, nums[nums.size() - 1] + nums[0] + h) -
                  min(nums[0] + nums[1] + h, nums[1] + nums[2]);
  }
  cout << minGoodness << endl;
  for (unsigned int i = 0; i < oNums.size(); i++) {
    if (oNums[i] == nums[0] && change) {
      change = false;
      cout << "2 ";
    } else {
      cout << "1 ";
    }
  }
  return 0;
}
