#include <bits/stdc++.h>   using namespace std;   int main() {     int n, h;     cin >> n >> h;     vector<int> a(n, 0);     copy(istream_iterator<int>(cin), istream_iterator<int>(), a.begin());     vector<int> a_orig = a;     sort(a.begin(), a.end());     int max1 = a[n - 1] + a[n - 2];     int min1 = a[0] + a[1];     int best_sofar = max1 - min1;     vector<int> res(n, 2);     if (n >= 3) {       min1 = min(min1 + h, a[1] + a[2]);       max1 = max(max1, a[0] + a[n - 1] + h);       if (abs(max1 - min1) < best_sofar) {         best_sofar = abs(max1 - min1);         res[distance(a_orig.begin(), min_element(a_orig.begin(), a_orig.end()))] =             1;       }     }     cout << best_sofar << endl;     copy(res.begin(), res.end(), ostream_iterator<int>(cout,    ));     cout << endl;     return 0;   }   