| UTPC Contest 1-28-2026 |
|---|
| Finished |
Magikarp wants to create perfectly shaped snowballs with his $$$n$$$ friends. To do this, he tells his friends to make a chain to speed up this process.
Magikarp's friends are numbered from $$$1$$$ to $$$n$$$, inclusive, and they are lined up in order of their number, with $$$1$$$ on the very left and $$$n$$$ on the very right. Each friend can take one snowball from the friend on their left, process it in $$$a_i$$$ seconds, and pass it to the friend on their right. Each friend can only process one snowball at a time, and they will do this optimally.
Assuming that there is an infinite pile of snowballs to the left of friend $$$1$$$, how many finished snowballs are produced by friend $$$n$$$ in $$$t$$$ seconds?
The first line of input contains $$$n$$$ an $$$t$$$ $$$(1\le n\le 2\cdot 10^5, 1\le t\le 10^9)$$$ — the number of friends, and the total time in seconds.
The second line of input contains $$$a_1,a_2,\ldots,a_n$$$ $$$(1\le a_i\le 10^9)$$$ — the time it takes for each friend to process one snowball.
Output a single integer, the number of finished snowballs produced after $$$t$$$ seconds.
5 251 4 2 3 4
3
2 101 1
9
In the second testcase, the first snowball gets processed by the first friend at $$$t=1$$$. It is then finished at $$$t=2$$$. The second snowball gets processed by the first friend at $$$t=2$$$ and gets finished at $$$t=3$$$. This process repeats 9 times for 9 finished snowballs. Note that when $$$t=10$$$, the first friend has finished processing a 10th snowball, but since it has not passed through all the friends, it is not counted.
| Name |
|---|


