#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000,100000000")
using namespace std;
const long long inf = 1e18 + 7;
const long long mod = 1e9 + 7;
const double eps = 1e-10;
const double PI = 2 * acos(0.0);
const double E = 2.71828;
const long long maxn = 100005LL;
pair<long long, long long> a[maxn];
long long ans[maxn];
int main(void) {
  long long n, h;
  cin >> n >> h;
  for (long long(i) = 0; (i) < (long long)(n); (i)++)
    cin >> a[i].first, a[i].second = i;
  sort(a, a + n);
  long long x1 =
      max(a[n - 1].first + a[n - 2].first, a[0].first + a[n - 1].first + h);
  long long x2 = min(a[0].first + a[1].first + h, a[1].first + a[2].first);
  long long y = a[n - 1].first + a[n - 2].first - a[0].first - a[1].first;
  fill(ans, ans + n, 2);
  if (x1 - x2 < y) ans[a[0].second] = 1;
  cout << min(x1 - x2, y) << endl;
  for (long long(i) = 0; (i) < (long long)(n); (i)++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
