Problem: This problem is the most boring one you've ever seen. 

Given a sequence of integers a1, a2, ..., an and a non-negative integer h, our goal is to partition the sequence into two subsequences (not necessarily consist of continuous elements). Each element of the original sequence should be contained in exactly one of the result subsequences. Note, that one of the result subsequences can be empty.

Let's define function f(ai, aj) on pairs of distinct elements (that is i ≠ j) in the original sequence. If ai and aj are in the same subsequence in the current partition then f(ai, aj) = ai + aj otherwise f(ai, aj) = ai + aj + h. 

Consider all possible values of the function f for some partition. We'll call the goodness of this partiotion the difference between the maximum value of function f and the minimum value of function f.

Your task is to find a partition of the given sequence a that have the minimal possible goodness among all possible partitions.

Input

The first line of input contains integers n and h (2 ≤ n ≤ 105, 0 ≤ h ≤ 108). In the second line there is a list of n space-separated integers representing a1, a2, ..., an (0 ≤ ai ≤ 108).

Output

The first line of output should contain the required minimum goodness. 

The second line describes the optimal partition. You should print n whitespace-separated integers in the second line. The i-th integer is 1 if ai is in the first subsequence otherwise it should be 2.

If there are several possible correct answers you are allowed to print any of them.

Examples

Input

3 2
1 2 3


Output

1
1 2 2 


Input

5 10
0 1 0 2 1


Output

3
2 2 2 2 2 

Note

In the first sample the values of f are as follows: f(1, 2) = 1 + 2 + 2 = 5, f(1, 3) = 1 + 3 + 2 = 6 and f(2, 3) = 2 + 3 = 5. So the difference between maximum and minimum values of f is 1.

In the second sample the value of h is large, so it's better for one of the sub-sequences to be empty.

Solution (in JAVA):

Solution:
/* Codeforces Template */

import java.io.*;
import java.math.*;
import java.util.*;

import static java.lang.Math.*;
import static java.util.Arrays.fill;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.sort;

public class Main {
	
	static long initTime;
	static final Random rnd = new Random(7777L);
	static boolean writeLog = false;
	
	public static void main(String[] args) throws IOException {
		initTime = System.currentTimeMillis();
		try {
			writeLog = "true".equals(System.getProperty("LOCAL_RUN_7777"));
		} catch (SecurityException e) {}
		new Thread(null, new Runnable() {
			public void run() {
				try {
					try {
						if (new File("input.txt").exists())
							System.setIn(new FileInputStream("input.txt"));
					} catch (SecurityException e) {}
					long prevTime = System.currentTimeMillis();
					new Main().run();
					log("Total time: " + (System.currentTimeMillis() - prevTime) + " ms");
					log("Memory status: " + memoryStatus());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start(); 
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
		in.close();
	}
	
	/*************************************************************** 
	 * Solution
	 **************************************************************/

	final long PINF = Long.MAX_VALUE;
	final long NINF = Long.MIN_VALUE;
	
	int n;
	long h;
	long[] a;
	
	void solve() throws IOException  {
		
		n = nextInt();
		h = nextLong();
		a = nextLongArray(n);
	
		if (n < 7) {
			solveStupid();
			return;
		}
	
		Item[] items = new Item [n];
		for (int i = 0; i < n; i++) {
			items[i] = new Item(i, a[i]);
		}
		
		sort(items);
		
		int bestB = -1;
		long bestVal = PINF;
		
		for (int b = 0; b < n; b++) {
			long max = NINF;
			long min = PINF;
			if (b + 1 < n) max = max(max, items[n - 1].val + items[n - 2].val);
			if (0 < b) max = max(max, items[b - 1].val + items[n - 1].val + h);
			if (b + 1 < n) min = min(min, items[b].val + items[b + 1].val);
			if (1 < b) min = min(min, items[0].val + items[1].val);
			if (0 < b) min = min(min, items[0].val + items[b].val + h);
			long curVal = max - min;
			if (bestVal > curVal) {
				bestVal = curVal;
				bestB = b;
			}
		}
		
		int[] ans = new int [n];
		fill(ans, 1);
	
		if (n > 2) {
			long max = max(items[n - 1].val + (n == 3 ? items[n - 3].val : items[n - 2].val), items[1].val + items[n - 1].val + h);
			long min = min(items[0].val + items[1].val + h, items[0].val + items[2].val);
			long curVal = max - min;
			if (bestVal > curVal) {
				bestVal = curVal;
				ans[items[1].id] = 2;
			} else {
				for (int i = 0; i < bestB; i++) ans[items[i].id] = 2;
			}
		}
		
		out.println(bestVal);
		printArray(ans);
	}
	
	class Item implements Comparable<Item> {
		int id;
		long val;

		Item(int id, long val) {
			this.id = id;
			this.val = val;
		}

		@Override
		public int compareTo(Item item) {
			if (val != item.val) return val < item.val ? -1 : 1;
			if (id != item.id) return id < item.id ? -1 : 1;
			return 0;
		}
	}
	
	void solveStupid() {
		int bestMask = 0;
		long bestVal = PINF;
		
		for (int mask = 0; mask < (1 << n); mask++) {
			long val = calc(mask);
			if (bestVal > val) {
				bestVal = val;
				bestMask = mask;
			}
		}
		
		out.println(bestVal);
		for (int i = 0; i < n; i++) {
			if (i > 0) out.print(' ');
			out.print((((bestMask >> i) & 1) == 1) ? '2' : '1');
		}
		out.println();
	}

	long calc(int mask) {
		long max = NINF;
		long min = PINF;
		for (int i = 0; i < n; i++) {
			for (int j = i + 1; j < n; j++) {
				long f = f(i, j, mask);
				max = max(max, f);
				min = min(min, f);
			}
		}
		return max - min;
	}

	long f(int i, int j, int mask) {
		return a[i] + a[j] + ((((mask >> i) & 1) == ((mask >> j) & 1)) ? 0L : h);
	}

	/*************************************************************** 
	 * Input 
	 **************************************************************/
	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");
	
	String nextToken() throws IOException {
		while (!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}
	
	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}
	
	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}
	
	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
	
	int[] nextIntArray(int size) throws IOException {
		int[] ret = new int [size];
		for (int i = 0; i < size; i++)
			ret[i] = nextInt();
		return ret;
	}
	
	long[] nextLongArray(int size) throws IOException {
		long[] ret = new long [size];
		for (int i = 0; i < size; i++)
			ret[i] = nextLong();
		return ret;
	}
	
	double[] nextDoubleArray(int size) throws IOException {
		double[] ret = new double [size];
		for (int i = 0; i < size; i++)
			ret[i] = nextDouble();
		return ret;
	}
	
	String nextLine() throws IOException {
		st = new StringTokenizer("");
		return in.readLine();
	}
	
	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			st = new StringTokenizer(s);
		}
		return false;
	}
	
	/*************************************************************** 
	 * Output 
	 **************************************************************/
	void printRepeat(String s, int count) {
		for (int i = 0; i < count; i++)
			out.print(s);
	}
	
	void printArray(int[] array) {
		if (array == null || array.length == 0)
			return;
		for (int i = 0; i < array.length; i++) {
			if (i > 0) out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}
	
	void printArray(long[] array) {
		if (array == null || array.length == 0)
			return;
		for (int i = 0; i < array.length; i++) {
			if (i > 0) out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}
	
	void printArray(double[] array) {
		if (array == null || array.length == 0)
			return;
		for (int i = 0; i < array.length; i++) {
			if (i > 0) out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}
	
	void printArray(double[] array, String spec) {
		if (array == null || array.length == 0)
			return;
		for (int i = 0; i < array.length; i++) {
			if (i > 0) out.print(' ');
			out.printf(Locale.US, spec, array[i]);
		}
		out.println();
	}
	
	void printArray(Object[] array) {
		if (array == null || array.length == 0)
			return;
		boolean blank = false;
		for (Object x : array) {
			if (blank) out.print(' '); else blank = true;
			out.print(x);
		}
		out.println();
	}
	
	@SuppressWarnings("rawtypes")
	void printCollection(Collection collection) {
		if (collection == null || collection.isEmpty())
			return;
		boolean blank = false;
		for (Object x : collection) {
			if (blank) out.print(' '); else blank = true;
			out.print(x);
		}
		out.println();
	}
	
	/*************************************************************** 
	 * Utility
	 **************************************************************/
	static String memoryStatus() {
		return (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory() >> 20) + "/" + (Runtime.getRuntime().totalMemory() >> 20) + " MB";
	}
	
	static void checkMemory() {
		System.err.println(memoryStatus());
	}
	
	static long prevTimeStamp = Long.MIN_VALUE;
	
	static void updateTimer() {
		prevTimeStamp = System.currentTimeMillis();
	}
	
	static long elapsedTime() {
		return (System.currentTimeMillis() - prevTimeStamp);
	}
	
	static void checkTimer() {
		System.err.println(elapsedTime() + " ms");
	}
	
	static void chk(boolean f) {
		if (!f) throw new RuntimeException("Assert failed");
	}
	
	static void chk(boolean f, String format, Object ... args) {
		if (!f) throw new RuntimeException(String.format(format, args));
	}
	
	static void log(String format, Object ... args) {
		if (writeLog) System.err.println(String.format(Locale.US, format, args));
	}
}