B: Rounds
题号:NC220697
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

    The popular PefectSharp online group gathers fans of workouts and healthy lifestyle all over the world. Every group member has managed to gain a certain amount of credits for the trendy MV03 online sports platform, giving them access to various workout and relaxation resources.
    The amount of credits owned may however largely differ from one person to the other. Since PefectSharp  members value sharing and solidarity, they decide to redispatch credits by playing the following game:
    The N group members are numbered from 1 to N and the game comprises k rounds, for some integer k such that  . During the i-th round of the game, all members except member i give S credits to member i. The game may end after any round, and its outcome will be the minimum amount of credits held by a member of the group after that round.
    Your task is to figure out the maximum possible game outcome, across all possible game endings.

输入描述:

The first line of the input contains two integers N and S. 
Each of the N following lines contains a single integer, the (i + 1)-th line containing the amount of credits Ciinitially owned by member i.

输出描述:

The output should contain a single integer value C corresponding to the maximum possible game outcome.
示例1

输入

复制
3 10
24
42
38

输出

复制
28

说明

The game proceeds as follows:
After round 1 the amounts of credits held are 44, 32, 28 and the minimum is 28.
After round 2 the amounts of credits held are 34, 52, 18 and the minimum is 18.
After round 3 the amounts of credits held are 24, 42, 38 and the minimum is 24.
The best possible outcome is therefore 28, which corresponds to ending the game after round 1.


备注:


for all, and .