#include <bits/stdc++.h>
using namespace std;
int n, h, ans[100005];
struct node {
  int x, id;
} a[100005];
bool cmp(node p, node q) { return p.x < q.x; }
bool check() {
  if (n == 2) {
    printf("0\n");
    return false;
  }
  int Max1, Min1;
  Min1 = a[1].x + a[2].x;
  Max1 = a[n].x + a[n - 1].x;
  int Max2, Min2;
  Min2 = min(a[1].x + a[2].x + h, a[2].x + a[3].x);
  Max2 = max(a[1].x + a[n].x + h, Max1);
  printf("%d\n", min(Max2 - Min2, Max1 - Min1));
  if (Max2 - Min2 < Max1 - Min1)
    return true;
  else
    return false;
}
int main() {
  scanf("%d%d", &n, &h);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i].x);
    a[i].id = i;
    ans[i] = 1;
  }
  sort(a + 1, a + 1 + n, cmp);
  if (check()) ans[a[1].id] = 2;
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
