#BS0000071. Dao tẩm độc (Poisoned Dagger)
Dao tẩm độc (Poisoned Dagger)
Poisoned Dagger
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
A dragon has HP. Attacks happen at strictly increasing seconds . Each attack starts a poison lasting seconds and dealing one damage per second; a new attack cancels any remaining old poison and restarts it. Find the minimum integer causing at least total damage.
Input
The first line contains . The second line contains .
Output
Print the minimum .
Subtasks
- Subtask 1 — 20%: , .
- Subtask 2 — 30%: .
- Subtask 3 — 50%: , , .
Example
Input
3 10
2 4 10
Output
4
Explanation
For , the three attacks contribute 2, 4, and 4 damage.