#include <bits/stdc++.h>
using namespace std;
struct Node {
  int x;
  int id;
} a[100006];
int n, h;
int b[100006];
bool cmp(const Node a, const Node b) { return a.x < b.x; }
int main() {
  scanf("%d%d", &n, &h);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i].x);
    a[i].id = i;
  }
  for (int i = 1; i <= n; i++) b[i] = 2;
  sort(a + 1, a + n + 1, cmp);
  int ans1 = a[n].x + a[n - 1].x - a[1].x - a[2].x;
  int ans2 = max(a[n].x + a[n - 1].x, a[n].x + a[1].x + h) -
             min(a[2].x + a[3].x, a[1].x + a[2].x + h);
  if (ans1 > ans2) {
    b[a[1].id] = 1;
    ans1 = ans2;
  }
  cout << ans1 << endl;
  for (int i = 1; i <= n; i++) {
    cout << b[i] << " ";
  }
  cout << endl;
  return 0;
}
