#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, a[100100], v[100100];
  scanf("%I64d%I64d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%I64d", &a[i]);
  if (n == 2) {
    puts("0");
    puts("1 1");
    return 0;
  }
  for (int i = 0; i < n; i++) v[i] = a[i];
  sort(a, a + n);
  long long int aa = abs((a[0] + a[1]) - (a[n - 1] + a[n - 2]));
  long long int bb = abs(min((a[0] + a[1] + m), (a[1] + a[2])) -
                         max((a[0] + a[n - 1] + m), (a[n - 1] + a[n - 2])));
  if (aa > bb) {
    printf("%I64d\n", bb);
    for (int i = 0; i < n; i++) {
      if (v[i] == a[0])
        a[0] = -1, printf("2 ");
      else
        printf("1 ");
    }
  } else {
    printf("%I64d\n", aa);
    for (int i = 0; i < n; i++) {
      printf("1 ");
    }
  }
  printf("\n");
}
