#include <bits/stdc++.h>
using namespace std;
int d[111111], n, h, i;
pair<int, int> f[111111];
int main() {
  scanf("%d%d", &n, &h);
  for (i = 1; i <= n; i++) {
    scanf("%d", &d[i]);
    f[i] = make_pair(d[i], i);
  }
  sort(f + 1, f + n + 1);
  int ans = (f[n].first + f[n - 1].first) - (f[1].first + f[2].first), k = 0;
  if (ans >
      abs(min(f[1].first + f[2].first + h, f[2].first + f[3].first) -
          max(f[n].first + f[n - 1].first, f[1].first + f[n].first + h))) {
    k = 1;
    ans = abs(min(f[1].first + f[2].first + h, f[2].first + f[3].first) -
              max(f[n].first + f[n - 1].first, f[1].first + f[n].first + h));
  }
  for (i = 1; i <= k; i++) d[f[i].second] = 1;
  for (i = k + 1; i <= n; i++) d[f[i].second] = 2;
  printf("%d\n", ans);
  for (i = 1; i < n; i++) printf("%d ", d[i]);
  printf("%d", d[n]);
}
