#abc365c. C - Transportation Expenses

C - Transportation Expenses

Score : 300300 points

问题陈述

NN 个人参加一个活动,第 ii 个人的交通费用是 AiA_i 日元。

活动组织者高桥决定设定一个交通补贴的最大限额 xx。第 ii 个人的补贴将是 min(x,Ai)\min(x, A_i) 日元。这里,xx 必须是一个非负整数。

已知高桥的预算是 MM 日元,他希望所有 NN 个人的总交通补贴最多为 MM 日元,那么补贴限额 xx 的最大可能值是多少?

如果补贴限额可以无限大,那么请报告这一点。

以上为大语言模型 kimi 翻译,仅供参考。

Problem Statement

There are NN people participating in an event, and the transportation cost for the ii-th person is AiA_i yen.

Takahashi, the organizer of the event, decided to set a maximum limit xx for the transportation subsidy. The subsidy for person ii will be min(x,Ai)\min(x, A_i) yen. Here, xx must be a non-negative integer.

Given that Takahashi's budget is MM yen, and he wants the total transportation subsidy for all NN people to be at most MM yen, what is the maximum possible value of the subsidy limit xx?

If the subsidy limit can be made infinitely large, report that instead.

Constraints

  • 1N2×1051 \leq N \leq 2 \times 10^5
  • 1M2×10141 \leq M \leq 2 \times 10^{14}
  • 1Ai1091 \leq A_i \leq 10^9
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

NN MM

A1A_1 A2A_2 \ldots ANA_{N}

Output

Print the maximum value of the subsidy limit xx that satisfies the budget condition, as an integer.

If the subsidy limit can be made infinitely large, print infinite instead.

Sample Input 1

4 8
1 3 2 4

Sample Output 1

2

If the subsidy limit is set to 22 yen, the total transportation subsidy for all NN people is min(2,1)+min(2,3)+min(2,2)+min(2,4)=7\min(2,1) + \min(2,3) + \min(2,2) + \min(2,4) = 7 yen, which is within the budget of 88 yen.

If the subsidy limit is set to 33 yen, the total transportation subsidy for all NN people is min(3,1)+min(3,3)+min(3,2)+min(3,4)=9\min(3,1) + \min(3,3) + \min(3,2) + \min(3,4) = 9 yen, which exceeds the budget of 88 yen.

Therefore, the maximum possible value of the subsidy limit is 22 yen.

Sample Input 2

3 20
5 3 2

Sample Output 2

infinite

The subsidy limit can be made infinitely large.

Sample Input 3

10 23
2 5 6 5 2 1 7 9 7 2

Sample Output 3

2