#include <bits/stdc++.h>
using namespace std;
pair<int, int> A[100010];
int T[100001];
int main() {
  int n, h;
  scanf("%d%d", &n, &h);
  for (int i = 0, n_ = (n); i < n_; i++) {
    scanf("%d", &A[i].first);
    A[i].second = i;
  }
  sort(A, A + n);
  int mn = 1073741823;
  int idx = -1;
  for (int end = 0, b_ = n; end <= (b_); end++) {
    int ai = 0;
    int ae = end - 1;
    int bi = end;
    int be = n - 1;
    vector<int> R;
    if (ae >= 0 && bi < n) {
      R.push_back(A[ae].first + A[be].first + h);
      R.push_back(A[ai].first + A[bi].first + h);
    }
    if (ae - ai >= 1) {
      R.push_back(A[ae].first + A[ae - 1].first);
      R.push_back(A[ai].first + A[ai + 1].first);
    }
    if (be - bi >= 1) {
      R.push_back(A[be].first + A[be - 1].first);
      R.push_back(A[bi].first + A[bi + 1].first);
    }
    sort(R.begin(), R.end());
    int d = abs(R.back() - R.front());
    if (d < mn) {
      mn = d;
      idx = end;
    }
  }
  for (int i = 0, n_ = (idx); i < n_; i++) T[A[i].second] = 1;
  for (int i = idx, b_ = n - 1; i <= (b_); i++) T[A[i].second] = 2;
  printf("%d\n", mn);
  for (int i = 0, n_ = (n); i < n_; i++)
    if (i < n - 1)
      printf("%d ", T[i]);
    else
      printf("%d\n", T[i]);
  return 0;
}
