#include <bits/stdc++.h>
using namespace std;
long long int inf = 1e18;
long long int p = 1e9 + 7;
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int pwr(long long int x, long long int y) {
  long long int res = 1;
  x = x;
  while (y > 0) {
    if (y & 1) res = (res * x);
    y = y >> 1;
    x = (x * x);
  }
  return res;
}
long long int modInverse(long long int n, long long int p) {
  return power(n, p - 2, p);
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int i, y, x, z, g, key, h, n, m, t, a, b, c, j, k;
  long long int t2, t3, t4, t1, t5, t6;
  string s;
  long long int l, r;
  t = 1;
  while (t--) {
    cin >> n >> h;
    vector<long long int> arr;
    vector<pair<long long int, long long int> > vec;
    for (i = 0; i < n; i++) {
      cin >> x;
      vec.push_back(make_pair(x, i));
      arr.push_back(x);
    }
    sort(arr.begin(), arr.end());
    sort(vec.begin(), vec.end());
    long long int ans = (arr[n - 1] + arr[n - 2]) - (arr[0] + arr[1]);
    long long int ind = 0;
    for (i = 1; i < n; i++) {
      long long int mn = arr[0] + arr[i] + h;
      if (i > 1)
        mn = std::min(mn, arr[0] + arr[1]);
      else {
        mn = std::min(mn, arr[i] + arr[i + 1]);
      }
      long long int mx = arr[i - 1] + arr[n - 1] + h;
      if (i != n - 1) {
        mx = std::max(mx, arr[n - 1] + arr[n - 2]);
      }
      long long int t1 = mx - mn;
      if (t1 < ans) {
        ans = t1;
        ind = i;
      }
    }
    long long int val[n];
    for (i = 0; i < n; i++) {
      auto u = vec[i];
      if (i < ind)
        val[u.second] = 2;
      else
        val[u.second] = 1;
    }
    cout << ans << "\n";
    for (i = 0; i < n; i++) cout << val[i] << " ";
  }
  return 0;
}
