#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
const long long int N = 4e5 + 10;
long long int t;
long long int n, h;
long long int x;
vector<pair<long long int, long long int>> v;
long long int anz[N];
long long int mx, mn;
void solve() {
  long long int x;
  cin >> n >> h;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    v.push_back({x, i});
  }
  long long int ans = 1e18;
  long long int tp = -1;
  sort(v.begin(), v.end());
  for (int i = 0; i < 2; i++) {
    switch (i) {
      case 0:
        mn = v[0].first + v[1].first;
        mx = v[n - 1].first + v[n - 2].first;
        break;
      case 1:
        mx = max(v[n - 1].first + v[n - 2].first,
                 v[n - 1].first + v[0].first + h);
        mn = v[0].first + v[1].first + h;
        if (n > 2) mn = min(mn, v[1].first + v[2].first);
        break;
      case 2:
        mx = max(v[n - 1].first + v[n - 2].first,
                 v[n - 1].first + v[1].first + h);
        mn = v[0].first + v[1].first;
        if (n > 2) {
          mn = min(mn, v[0].first + v[2].first + h);
          if (n > 3) mn = min(mn, v[2].first + v[3].first);
        }
        break;
    }
    if (mx - mn < ans) {
      ans = mx - mn;
      tp = i;
    }
  }
  cout << ans << endl;
  for (int i = 0; i < tp; i++) anz[v[i].second] = 1;
  for (int i = tp; i < n; i++) anz[v[i].second] = 2;
  for (int i = 1; i <= n; i++) cout << anz[i] << " ";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
