You are designing advanced chips for machines. Manufacturing the chips is straightforward, but supplying power to them is challenging because the available batteries have varied output powers.
Consider the situation where there are machines, each with two chips. Each chip requires batteries for power. Surprisingly, it does not matter how much total power each chip receives, but a machine works best when its two chips have output powers as close as possible. The output power of a chip is the minimum output power among its batteries.
You have batteries in total, and you must assign them to the chips. It may be impossible to allocate the batteries so that in every machine the two chips have equal output powers. However, you want to allocate the batteries so that, in all machines, the difference between the output powers of the two chips is minimized. Specifically, you want to guarantee to your customers that, in every machine, the difference between the output powers of its two chips does not exceed , and you want to make as small as possible. To do this, you must determine an optimal allocation of the batteries to the machines.
Consider Sample Input 1. There are machines, each requiring batteries per chip, and a supply of batteries with output powers , , , , , , , , , , , . For example, you can assign the batteries with output , , to one chip and , , to the other chip of the same machine; and assign , , to the third chip, and , , to the fourth chip. The chip output powers are , , , and respectively, and in both machines the difference between the chips' output powers is . Note that there are other ways to achieve the same result.
The input consists of a single test case containing two lines. The first line contains two positive integers: the number of machines , and the number of batteries per chip , with 2nk \leq 10^6. The second line contains integers p_i (1 \leq p_i \leq 10^9), specifying the output powers of the batteries.
Print the smallest integer such that you can distribute the batteries such that, in each machine, the difference between the output powers of its two chips does not exceed .
Example 1