#include <bits/stdc++.h>
using namespace std;
int n, h;
pair<int, int> a[100000];
int r[100000];
int main() {
  scanf("%d%d", &n, &h);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i].first), a[i].second = i;
  sort(a, a + n);
  int ans = INT_MAX, idx = 0;
  for (int i = 0; i <= n; ++i) {
    int MIN = INT_MAX, MAX = INT_MIN;
    if (i > 0 && i < n) MIN = min(MIN, a[0].first + a[i].first + h);
    if (i > 1) {
      MIN = min(MIN, a[0].first + a[1].first);
      MAX = max(MAX, a[i - 1].first + a[i - 2].first);
    }
    if (i < n && i > 0) MAX = max(MAX, a[n - 1].first + a[i - 1].first + h);
    if (i < n - 1) {
      MAX = max(MAX, a[n - 1].first + a[n - 2].first);
      MIN = min(MIN, a[i].first + a[i + 1].first);
    }
    if (MAX - MIN < ans) {
      idx = i, ans = MAX - MIN;
    }
  }
  printf("%d\n", ans);
  for (int j = 0; j < idx; ++j) r[a[j].second] = 1;
  for (int j = idx; j < n; ++j) r[a[j].second] = 2;
  for (int i = 0; i < n; ++i) printf("%d ", r[i]);
  return 0;
}
