PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#BS0000294. Xây bể cá (Building an Aquarium)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Xây bể cá (Building an Aquarium)

Building an Aquarium

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn coral columns of heights aia_i. Choose an integer tank height h≥1h\ge1. Column i requires h−aih-a_i units of water if it is shorter than h, and zero otherwise. At most xx units of water are available. Find the maximum height.

Input

First line: n,xn,x. Second line: nn integers aia_i.

Output

Print one integer: the maximum achievable value.

Subtasks

  • Subtask 1 (20 points): 1≤n≤301\le n\le30; 1≤x,ai≤1001\le x,a_i\le100.
  • Subtask 2 (30 points): 1≤n≤2⋅1051\le n\le2\cdot10^5; 1≤x,ai≤1091\le x,a_i\le10^9; a1=⋯=ana_1=\cdots=a_n.
  • Subtask 3 (50 points): 1≤n≤2⋅1051\le n\le2\cdot10^5; 1≤x,ai≤1091\le x,a_i\le10^9.

Examples

Input 1

7 9
3 1 2 4 6 2 5

Output 1

4

Explanation

Height 4 costs 8 water units, while height 5 costs 13.

Input 2

1 1000000000
1

Output 2

1000000001

Explanation

All water is used on the single column.