#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000000;
const int MOD = 1000000007;
int a[100001];
pair<int, int> g[100001];
int res[100001];
int main() {
  int n, h;
  cin >> n >> h;
  for (int i = 1; i <= n; ++i) cin >> a[i], g[i] = make_pair(a[i], i);
  sort(g + 1, g + n + 1);
  sort(a + 1, a + n + 1);
  memset(res, 0, sizeof(res));
  long long ans = inf;
  int will;
  for (int i = 1; i <= n; ++i) {
    int mn = inf, mx = -inf;
    if (i >= 2) mn = min(a[1] + a[2], mn);
    if (i + 2 <= n) mn = min(a[i + 1] + a[i + 2], mn);
    if (i >= 1 && i < n) mn = min(mn, a[1] + a[i + 1] + h);
    if (i >= 2) mx = max(a[i] + a[i - 1], mx);
    if (i + 2 <= n) mx = max(a[n] + a[n - 1], mx);
    if (i >= 1 && i < n) mx = max(mx, a[i] + a[n] + h);
    if (mx - mn < ans) {
      ans = mx - mn;
      will = i;
    }
  }
  for (int i = 1; i <= will; ++i) res[g[i].second] = 1;
  for (int i = will + 1; i <= n; ++i) res[g[i].second] = 2;
  cout << ans << endl;
  for (int i = 1; i <= n; ++i) cout << res[i] << " ";
  cout << endl;
}
