268 传统题

[CF2290G1] 环湖步道(简单版)(Lakeside Trail - Easy)

时间限制
4000ms
内存限制
256MiB
登顶 / 尝试
0/ 0
难度
4

[CF2290G1] 环湖步道(简单版)(Lakeside Trail - Easy)

Problem Statement

(This is the Easy Version of the problem; the constraints on tt and nn are smaller.)

A circular lakeside trail consists of nn segments numbered 11 through nn in clockwise order, where segment ii initially has height hih_i. Segment nn is also adjacent to segment 11.

The steepness of the trail is defined as the maximum absolute height difference between any two adjacent segments, i.e., max⁡1≤i≤n∣hi−hi+1∣\max_{1 \le i \le n} |h_i - h_{i+1}| (with hn+1=h1h_{n+1} = h_1).

You have kk units of dirt. Spending 11 unit of dirt increases the height of a chosen segment by 11 (you may spend multiple units on the same segment, and heights can only be increased, never decreased).

Find the minimum possible steepness of the trail after spending at most kk units of dirt.

Input

The first line contains tt (1≤t≤5001 \le t \le 500) — the number of test cases.

The first line of each test case contains nn and kk (3≤n≤20003 \le n \le 2000, 0≤k≤10180 \le k \le 10^{18}). The second line contains nn integers h1,h2,…,hnh_1, h_2, \dots, h_n (1≤hi≤1091 \le h_i \le 10^9).

It is guaranteed that the sum of nn over all test cases does not exceed 20002000.

Output

For each test case, print a single integer — the minimum possible steepness.

Example

6
4 3
1 5 2 8
5 5
2 9 4 1 6
3 0
1 4 7
3 100
1 10 1
5 5
4 1 1 1 1
6 14
3 6 2 4 1 5
5
4
6
0
2
1

Note

  • Constraints: 1≤t≤5001 \le t \le 500, 3≤n≤20003 \le n \le 2000, 0≤k≤10180 \le k \le 10^{18}, 1≤hi≤1091 \le h_i \le 10^9, ∑n≤2000\sum n \le 2000.
  • Source: Codeforces 2290G1 · Lakeside Trail (Easy Version)