#include <bits/stdc++.h>
using namespace std;
struct Node {
  int x;
  int id;
} a[100010];
bool cmp(Node a, Node b) { return a.x < b.x; }
int main() {
  int n, h;
  cin >> n >> h;
  ;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].x;
    a[i].id = i;
  }
  sort(a + 1, a + 1 + n, cmp);
  if (n == 2) {
    cout << 0 << endl;
    cout << 1 << ' ' << 1 << endl;
  } else {
    int maxx = max(a[n].x + a[n - 1].x, a[n].x + a[1].x + h);
    int minn = min(a[1].x + a[2].x + h, a[2].x + a[3].x);
    if (maxx - minn < a[n].x + a[n - 1].x - a[1].x - a[2].x) {
      cout << maxx - minn << endl;
      for (int i = 1; i <= n; i++) {
        if (i == a[1].id)
          cout << 1 << ' ';
        else
          cout << 2 << ' ';
      }
    } else {
      cout << a[n].x + a[n - 1].x - a[1].x - a[2].x << endl;
      for (int i = 1; i <= n; i++) {
        cout << 1 << ' ';
      }
    }
  }
}
