#include <bits/stdc++.h>
using namespace std;
int ToInt(string& s, int len) {
  int r = 0;
  for (int i = 0, max_ = (len); i < max_; ++i) {
    r *= 10;
    r += s[i] - '0';
  }
  return r;
}
int GCD(int a, int b) { return b != 0 ? GCD(b, a % b) : a; }
int LCM(int a, int b) { return a * (b / GCD(a, b)); }
long long Pow(long long n, long long e) {
  if (e == 0) return 1;
  if (e == 1)
    return n;
  else if (e & 1) {
    long long t = Pow(n, e / 2);
    return n * t * t;
  } else {
    long long t = Pow(n, e / 2);
    return t * t;
  }
}
int a[100001];
int ids[100001];
bool Comp(int b, int c) { return a[b] < a[c]; }
int main() {
  int N, H;
  scanf("%d %d", &N, &H);
  for (int i = 0, max_ = (N); i < max_; ++i) {
    scanf("%d", &a[i]);
    ids[i] = i;
  }
  sort(ids, ids + N, Comp);
  int r1 = a[ids[N - 1]] + a[ids[N - 2]] - (a[ids[1]] + a[ids[0]]);
  int r2 =
      std::max(a[ids[N - 1]] + a[ids[N - 2]], a[ids[N - 1]] + a[ids[0]] + H) -
      std::min(a[ids[1]] + a[ids[2]], a[ids[0]] + a[ids[1]] + H);
  if (r1 <= r2) {
    printf("%d\n", r1);
    for (int i = 0, max_ = (N); i < max_; ++i) printf("%d ", 1);
  } else {
    printf("%d\n", r2);
    for (int i = 0, max_ = (N); i < max_; ++i)
      if (i == ids[0])
        printf("%d ", 2);
      else
        printf("%d ", 1);
  }
  return 0;
}
