#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int inf = 1e9;
int n, h, ans = inf, type[N];
pair<int, int> a[N];
int calc(int x) {
  int mx = 0;
  int mn = inf;
  if (x == n) {
    mn = a[1].first + a[2].first;
    mx = a[n].first + a[n - 1].first;
  } else {
    mx = max(mx, a[n].first + a[x].first + h);
    mn = min(mn, a[1].first + a[x + 1].first + h);
    if (x + 1 < n)
      mx = max(mx, a[n].first + a[n - 1].first),
      mn = min(mn, a[x + 2].first + a[x + 1].first);
    if (x > 1)
      mn = min(mn, a[1].first + a[2].first),
      mx = max(mx, a[x].first + a[x - 1].first);
  }
  return mx - mn;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> h;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) ans = min(ans, calc(i));
  for (int i = 1; i <= n; i++)
    if (calc(i) == ans) {
      for (int j = 1; j <= i; j++) type[a[j].second] = 1;
      for (int j = i + 1; j <= n; j++) type[a[j].second] = 2;
      break;
    }
  cout << ans << endl;
  for (int i = 1; i <= n; i++) cout << type[i] << " ";
  return 0;
}
