#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 1;
long long V[N], VV[N];
long long ans[N];
long long calc(long long n) { return abs(V[n - 1] + V[n - 2] - (V[0] + V[1])); }
int main() {
  long long n, h;
  while (cin >> n >> h) {
    for (int i = 0; i < (int)n; i++) {
      cin >> V[i];
      VV[i] = V[i];
      ans[i] = 1;
    }
    if (n == 2) {
      cout << 0 << endl;
      cout << 1 << ' ' << 1 << endl;
      continue;
    }
    int t;
    sort(V, V + n);
    for (int i = 0; i < (int)n; i++)
      if (V[0] == VV[i]) t = i;
    long long res1 = calc(n);
    V[0] += h;
    sort(V, V + n);
    long long res2 = calc(n);
    cout << min(res1, res2) << endl;
    if (res1 <= res2) {
      for (int i = 0; i < (int)n; i++) {
        if (i != 0) cout << ' ';
        cout << 1;
      }
      cout << endl;
    } else {
      for (int i = 0; i < (int)n; i++) {
        if (i != 0) cout << ' ';
        if (i == t)
          cout << 2;
        else
          cout << 1;
      }
      cout << endl;
    }
  }
  return 0;
}
