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

#BS0000275. Giới hạn nhỏ nhất của túi bóng (Minimum Limit of Balls in a Bag)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Giới hạn nhỏ nhất của túi bóng (Minimum Limit of Balls in a Bag)

Minimum Limit of Balls in a Bag

Source: LeetCode

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn bags with aia_i balls in bag i. One operation replaces a bag with two nonempty bags whose total ball count equals the original count. With at most KK operations, minimize the largest ball count of any resulting bag.

Input

The first line contains n,Kn,K. The next line contains nn integers aia_i.

Output

Print the minimum possible maximum bag size.

Subtasks

  • Subtask 1 (20 points): 1≤n≤51\le n\le5; 1≤K≤61\le K\le6; 1≤ai≤81\le a_i\le8 (1≤i≤n1\le i\le n).
  • Subtask 2 (30 points): 1≤n≤1051\le n\le10^5; 1≤K,ai≤1091\le K,a_i\le10^9 (1≤i≤n1\le i\le n); a1=⋯=ana_1=\cdots=a_n.
  • Subtask 3 (50 points): 1≤n≤1051\le n\le10^5; 1≤K,ai≤1091\le K,a_i\le10^9 (1≤i≤n1\le i\le n).

Examples

Input 1

4 4
2 4 8 2

Output 1

2

Explanation

Split the 4-ball bag once and the 8-ball bag three times into bags of size 2. Achieving size 1 would require 12 splits.