#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> a[100001];
long long start = 0;
long long h;
long long res;
long long c[100001];
long long n;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> h;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a + 1, a + n + 1);
  res = a[n].first + a[n - 1].first - a[1].first - a[2].first;
  for (int i = n; i >= 2; --i) {
    long long curmax, curmin;
    if (i == n)
      curmax =
          max(a[n].first + a[n - 1].first + h, a[n - 1].first + a[n - 2].first);
    else
      curmax =
          max(a[n].first + a[n - 1].first, a[n].first + a[i - 1].first + h);
    if (i != 2)
      curmin = min(a[i].first + a[1].first + h, a[1].first + a[2].first);
    else
      curmin = min(a[2].first + a[1].first + h, a[2].first + a[3].first);
    long long curdif = curmax - curmin;
    if (curdif < res) {
      res = curdif;
      start = i - 1;
    }
  }
  for (int i = 1; i <= start; ++i) {
    c[a[i].second] = 1;
  }
  cout << res << endl;
  for (int i = 1; i <= n; ++i) {
    if (c[i])
      cout << c[i] << " ";
    else
      cout << 2 << " ";
  }
}
