#include <bits/stdc++.h>
using namespace std;
int a[100010], b[100010];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    b[i] = a[i];
  }
  if (n == 2) {
    printf("0\n");
    printf("1 1\n");
    return 0;
  }
  sort(a, a + n);
  int ans = a[n - 2] + a[n - 1] - a[0] - a[1];
  int Max = max(a[n - 1] + a[n - 2], a[0] + a[n - 1] + m);
  int Min = min(a[0] + a[1] + m, a[1] + a[2]);
  if (ans < Max - Min) {
    printf("%d\n", ans);
    for (int i = 0; i < n; i++) printf("1 ");
  } else {
    printf("%d\n", Max - Min);
    int flag = 1;
    for (int i = 0; i < n; i++) {
      if (b[i] == a[0] && flag) {
        printf("2 ");
        flag = 0;
      } else
        printf("1 ");
    }
  }
}
