#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fll;
const int MAXN = 1e5 + 10;
int v[MAXN], i[MAXN], cj[MAXN];
bool cmp(int a, int b) { return v[a] < v[b]; }
int main() {
  int n, h;
  scanf("%d%d", &n, &h);
  for (int a = 0; a < n; ++a) {
    scanf("%d", &v[a]);
    i[a] = a;
  }
  sort(i, i + n, cmp);
  int s1 = max(v[i[n - 1]] + v[i[n - 2]], v[i[n - 1]] + v[i[0]] + h) -
           min(v[i[0]] + v[i[1]] + h, v[i[1]] + v[i[2]]);
  int s2 = v[i[n - 1]] + v[i[n - 2]] - v[i[0]] - v[i[1]];
  if (s1 < s2) {
    cj[i[0]] = 1;
    printf("%d\n", s1);
  } else
    printf("%d\n", s2);
  for (int a = 0; a < n; ++a) printf("%d ", cj[a] + 1);
  printf("\n");
  return 0;
}
