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