#include <bits/stdc++.h>
using namespace std;
const int inf = int(1e9);
bool my_compare(const pair<int, int>& i, const pair<int, int>& j) {
  if (i.first > j.first) return false;
  if (j.first > i.first) return true;
  return j.second > i.second;
}
int check(vector<pair<int, int> > x, vector<pair<int, int> > y, int h) {
  vector<int> min;
  vector<int> max;
  if (y.size() > 0) {
    min.push_back(y.front().first + x.front().first + h);
    max.push_back(y.back().first + x.back().first + h);
  }
  if (y.size() > 1) {
    min.push_back(y[0].first + y[1].first);
    max.push_back(y[y.size() - 1].first + y[y.size() - 2].first);
  }
  min.push_back(x[0].first + x[1].first);
  max.push_back(x[x.size() - 1].first + x[x.size() - 2].first);
  sort(min.begin(), min.end());
  sort(max.begin(), max.end());
  return max.back() - min.front();
}
int main() {
  int n, h;
  cin >> n >> h;
  vector<pair<int, int> > a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a.at(i).first;
    a.at(i).second = i;
  }
  vector<pair<int, int> > b = a;
  sort(a.begin(), a.end(), my_compare);
  vector<pair<int, int> > x;
  x.assign(a.begin(), a.end());
  vector<pair<int, int> > y;
  int df1 = check(x, y, h);
  x.assign(++a.begin(), a.end());
  y.push_back(a[0]);
  int df2 = check(x, y, h);
  cout << min(df1, df2) << endl;
  for (int i = 0; i < n; ++i) {
    if (b[i].second == a[0].second && df2 < df1)
      cout << 1 << " ";
    else
      cout << 2 << " ";
  }
  cout << endl;
  return 0;
}
