#CF985D. 沙堡 / Sand Fortress
沙堡 / Sand Fortress
Source: Codeforces 985D - Sand Fortress
Statement
You build sand pillars on infinitely many positions numbered from left to right. You have n indivisible packs of sand. If position i receives h_i packs, its height is h_i.
There is a fence of height H immediately to the left of position 1, so the first pillar must satisfy h_1 <= H. Adjacent pillars must differ in height by at most 1, and all n packs must be used.
Find the minimum possible number of positions whose height is positive.
Input
One line contains n and H.
Output
Print the minimum number of occupied positions.
Constraints
1 <= n, H <= 10^18
5 2
3
6 8
3