#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100;
const int M = 4e4 + 100;
struct Node {
  int val, pos;
} arr[N];
bool cmp(Node a, Node b) { return a.val < b.val; }
int main() {
  int n, h;
  int ans1, ans2;
  cin >> n >> h;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i].val;
    arr[i].pos = i;
  }
  if (n == 2) {
    cout << 0 << endl;
    cout << 1 << " " << 1 << endl;
    return 0;
  }
  sort(arr + 1, arr + 1 + n, cmp);
  ans2 = max(arr[n].val + arr[1].val + h, arr[n].val + arr[n - 1].val) -
         min(arr[1].val + arr[2].val + h, arr[2].val + arr[3].val);
  ans1 = arr[n].val + arr[n - 1].val - (arr[1].val + arr[2].val);
  cout << min(ans1, ans2) << endl;
  if (ans1 < ans2) {
    for (int i = 1; i <= n; i++) {
      cout << 1 << " ";
    }
    cout << endl;
  } else {
    for (int i = 1; i <= n; i++) {
      if (i == arr[1].pos) {
        cout << 2 << " ";
      } else
        cout << 1 << " ";
    }
    cout << endl;
  }
  return 0;
}
