2020-07-25 09:00 AKDT



2020-07-25 12:00 AKDT
The end is near!
Contest is over.
Not yet started.
Contest is starting in -64 days 0:41:16

Time elapsed


Time remaining


Problem A

A beetle finds itself on a thin horizontal branch. “Here I am on a thin horizontal branch,” thinks the beetle, “I feel pretty much like on an x-axis!”. It surely is a beetle of deep mathematical thought.

There are also $n$ drops of dew on that same branch, each holding $m$ units of water. Their beetle-based integer coordinates are $x_1, x_2, \dots , x_ n$.

It is clear that the day will be hot. Already in one unit of time one unit of water goes away from each drop. The beetle is thirsty. It is so thirsty that if it reached a drop of dew it would drink it in zero time. In one unit of time the beetle can crawl one unit of length. But would all this crawling pay off? That’s what buzzes the beetle.

So you are to write a program which, given coordinates of dew drops, calculates the maximal amount of water the beetle can possibly drink.


The first line contains two integers $n$ ($0 \le n \le 300$) and $m$ ($1 \le m \le 10^6$).

The next $n$ lines contain integer coordinates $x_1, x_2, \dots , x_ n$ ($-10^4 \le x_ i \le 10^4$, $x_ i \not= x_ j$ for $i \not= j$).


Output a single integer: the maximum amount of water the beetle can possibly drink.

Sample Input 1 Sample Output 1
3 15