#include <bits/stdc++.h>
using namespace std;
struct Point {
  int id;
  int a;
} p[100010];
bool cmp(const Point &A, const Point &B) { return A.a > B.a; }
int s[200001];
int f[200001];
long long resu[100][100];
vector<Point> b;
int main() {
  long long n, h;
  cin >> n >> h;
  for (int i = 1; i <= n; i++) {
    cin >> p[i].a;
    p[i].id = i;
  }
  sort(p + 1, p + 1 + n, cmp);
  int top = min(n, 10ll);
  for (int i = 1; i <= min(n, 10ll); i++) b.push_back(p[i]);
  for (int i = n; i >= max(top + 1ll, n - 9ll); i--) b.push_back(p[i]);
  top = b.size();
  long long ans = 999999999999ll;
  for (int mask = 0; mask < (1 << (top - 1)); mask++) {
    for (int i = 0; i < top; i++) {
      if (mask & (1 << i))
        s[i] = 1;
      else
        s[i] = 0;
    }
    long long MAX = -1, MIN = 999999999999ll;
    for (int i = 0; i < top; i++)
      for (int j = i + 1; j < top; j++) {
        resu[i][j] = b[i].a + b[j].a;
        if (s[i] != s[j]) resu[i][j] += h;
        MAX = max(MAX, resu[i][j]);
        MIN = min(MIN, resu[i][j]);
      }
    if (MAX - MIN < ans) {
      ans = MAX - MIN;
      for (int i = 0; i < top; i++) {
        f[i] = s[i];
      }
    }
  }
  cout << ans << endl;
  memset(s, -1, sizeof(s));
  for (int i = 0; i < b.size(); i++) s[b[i].id] = f[i];
  for (int i = 1; i <= n; i++)
    if (s[i] != -1)
      cout << s[i] + 1 << " ";
    else
      cout << f[0] + 1 << " ";
  cout << endl;
  return 0;
}
