#include <bits/stdc++.h>
using namespace std;
int n, h, a[100005], id[100005];
bool cmp(int i, int j) { return a[i] < a[j]; }
int main() {
  scanf("%d%d", &n, &h);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) id[i] = i;
  sort(id + 1, id + n + 1, cmp);
  int sum = a[id[n]] + a[id[n - 1]] - a[id[2]] - a[id[1]];
  int MAX = max(a[id[n]] + a[id[n - 1]], a[id[n]] + a[id[1]] + h);
  int MIN = min(a[id[2]] + a[id[3]], a[id[1]] + a[id[2]] + h);
  if (sum <= MAX - MIN) {
    cout << sum << endl;
    for (int i = 1; i <= n; i++) printf("1 ");
  } else {
    cout << MAX - MIN << endl;
    for (int i = 1; i <= n; i++)
      if (i == id[1])
        printf("1 ");
      else
        printf("2 ");
  }
  return 0;
}
