#include <bits/stdc++.h>
using namespace std;
vector<pair<long long int, long long int> > v;
long long int a[100010];
int main() {
  long long int n, h, i, j;
  cin >> n >> h;
  v.push_back(make_pair(0, 0));
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    v.push_back(make_pair(a[i], i));
  }
  sort(v.begin(), v.end());
  long long int minn = INT_MAX;
  long long int idx = 0;
  for (i = 1; i <= n; i++) {
    long long int mn = INT_MAX;
    long long int mx = INT_MIN;
    if (i == 1) {
      mn =
          min(v[i].first + v[i + 1].first + h, v[i + 1].first + v[i + 2].first);
      mx = max(v[i].first + v[n].first + h, v[n - 1].first + v[n].first);
    } else if (i > 1 && i < n) {
      mn = v[1].first + v[2].first;
      mx = max(v[i].first + v[n].first + h, v[n - 1].first + v[n].first);
    } else {
      mn = v[1].first + v[2].first;
      mx = v[n - 1].first + v[n].first;
    }
    if (mx - mn < minn) {
      minn = mx - mn;
      idx = i;
    }
  }
  cout << minn << endl;
  for (i = 1; i <= n; i++) {
    if (i <= idx) {
      a[v[i].second] = 1;
    } else {
      a[v[i].second] = 2;
    }
  }
  for (i = 1; i <= n; i++) cout << a[i] << " ";
}
