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

#BS0000262. Hỗ trợ chi phí đi lại (Transportation Expenses)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Hỗ trợ chi phí đi lại (Transportation Expenses)

Transportation Expenses

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

Takahashi runs an event attended by NN people, with individual travel costs AiA_i yen. For a nonnegative integer cap xx, person ii receives min⁡(Ai,x)\min(A_i,x) yen. Given budget MM, determine the greatest affordable cap, or report that no finite upper bound is necessary.

Input

The first line contains integers N,MN,M.

The second line contains NN integers A1,…,ANA_1,\ldots,A_N.

Output

Print the greatest integer cap, or infinite if unbounded.

Subtasks

  • Subtask 1 (20 points): 1≤N≤201\le N\le20; 1≤M≤20001\le M\le2000; 1≤Ai≤1001\le A_i\le100 (1≤i≤N1\le i\le N).
  • Subtask 2 (30 points): 1≤N≤2⋅1051\le N\le2\cdot10^5; 1≤M≤2⋅10141\le M\le2\cdot10^{14}; 1≤Ai≤1091\le A_i\le10^9 (1≤i≤N1\le i\le N); A1=⋯=ANA_1=\cdots=A_N.
  • Subtask 3 (50 points): 1≤N≤2⋅1051\le N\le2\cdot10^5; 1≤M≤2⋅10141\le M\le2\cdot10^{14}; 1≤Ai≤1091\le A_i\le10^9 (1≤i≤N1\le i\le N).

Examples

Input 1

4 8
1 3 2 4

Output 1

2

Explanation

Cap 2 pays 1, 2, 2, 2, totaling 7; cap 3 costs 9, exceeding 8. Thus 2 is maximal.

Input 2

3 20
5 3 2

Output 2

infinite

Explanation

The total actual cost is only 10, so any cap remains within 20.