#include <bits/stdc++.h>
using namespace std;
int const MAXN = 100100;
long long const INF = 1000000000000000000LL;
int n;
long long H;
struct pp {
  long long val;
  int num;
  int color;
} s[MAXN];
struct Sorter_val {
  bool operator()(const pp& a, const pp& b) { return a.val < b.val; }
};
struct Sorter_num {
  bool operator()(const pp& a, const pp& b) { return a.num < b.num; }
};
int main() {
  scanf("%d%d", &n, &H);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    s[i].val = x;
    s[i].num = i;
  }
  sort(s, s + n, Sorter_val());
  long long ans = INF;
  int dvv;
  for (int i = -1; i <= n; i++) {
    long long mn = INF;
    if (i >= 1) mn = min(mn, s[0].val + s[1].val);
    if (i + 2 < n) mn = min(mn, s[i + 1].val + s[i + 2].val);
    if (i + 1 < n && i >= 0) mn = min(mn, s[i + 1].val + s[0].val + H);
    long long mx = -INF;
    if (i - 1 >= 0 && i < n) mx = max(mx, s[i - 1].val + s[i].val);
    if (n - 2 >= i + 1) mx = max(mx, s[n - 2].val + s[n - 1].val);
    if (i >= 0 && n - 1 >= i + 1 && i < n)
      mx = max(mx, s[n - 1].val + s[i].val + H);
    if (mn != INF && mx != -INF) {
      long long vl = mx - mn;
      if (vl < ans) {
        ans = vl;
        dvv = i;
      }
    }
  }
  cout << ans << "\n";
  for (int j = 0; j <= dvv; j++) s[j].color = 1;
  for (int j = dvv + 1; j < n; j++) s[j].color = 2;
  sort(s, s + n, Sorter_num());
  for (int i = 0; i < n; i++) {
    printf("%d", s[i].color);
    if (i < n - 1) printf(" ");
  }
  return 0;
}
