SOMPO HD プログラミングコンテスト2021(AtCoder Beginner Contest 192)
F
Potion
AtCoder
⌀ 1783
原题
← E→
翻译中…

Problem Statement

翻译中…

There are $N$ kinds of materials. Material $i$ has a magic power of $A_i$.

翻译中…

Takahashi, the magician, wants to make a potion by choosing one or more kinds from these materials and mixing them.

翻译中…

At the moment when he makes a potion by mixing $k$ kinds of materials, the magic power of the potion is the sum of the materials used. Then, every second, its magic power increases by $k$. Note that the increase of the magic power is a discrete - not continuous - process.

翻译中…

Takahashi will mix materials just once, at time $0$. What is the earliest time he can get a potion with a magic power of exactly $X$?

翻译中…

Under the constraints, it can be proved that it is possible to make a potion with a magic power of exactly $X$.

翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 100$
  • $1 \leq A_i \leq 10^7$
  • $10^9 \leq X \leq 10^{18}$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N X
A_1 \ldots A_N

翻译中…

Output

翻译中…

Print the earliest time he can get a potion with a magic power of exactly $X$.

翻译中…

样例

Input #1
3 9999999999
3 6 8
Output #1
4999999994
The potion made by mixing Material $1$ and Material $3$ has a magic power of $3+8=11$ at time $0$, and it increases by $2$ every second, so it will be $9999999999$ at time $4999999994$, which is the earliest possible time. The potion made by mixing all the materials $1, 2, 3$ will have a magic power of $9999999998$ at time $3333333327$ and $10000000001$ at time $3333333328$, so it will never be exactly $9999999999$.
Input #2
1 1000000000000000000
1
Output #2
999999999999999999
题目信息
题号
abc192_f
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。