#include <bits/stdc++.h>
using namespace std;
static bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  if (a.second == b.second) return a.first < b.first;
  return (a.second) < b.second;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, h;
  cin >> n >> h;
  vector<pair<long long, long long> > v(n);
  for (long long i = 0; i < n; i++) {
    cin >> v[i].first;
    v[i].second = i;
  }
  sort(v.begin(), v.end());
  long long ma = v[n - 1].first + v[n - 2].first;
  long long mi = v[0].first + v[1].first;
  if (v.size() == 2) {
    cout << 0 << endl;
    cout << 1 << " " << 1;
    return 0;
  }
  vector<long long> a;
  for (long long i = 1; i < n; i++) {
    a.push_back(v[0].first + v[i].first + h);
  }
  a.push_back(ma);
  a.push_back(v[1].first + v[2].first);
  sort(a.begin(), a.end());
  long long diff = a[a.size() - 1] - a[0];
  long long ind = v[0].second;
  if (ma - mi < diff) {
    cout << ma - mi << endl;
    for (long long i = 0; i < n; i++) {
      cout << 1 << " ";
    }
  } else {
    cout << diff << endl;
    for (long long i = 0; i < n; i++) {
      if (i == ind)
        cout << 2 << " ";
      else {
        cout << 1 << " ";
      }
    }
  }
  return 0;
}
