{"problem":{"name":"F. GukiZ Height","description":{"content":"GukiZ loves hiking in the mountains. He starts his hike at the height 0 and he has some goal to reach, initially equal to h. The mountains are described by a sequence of integers A0, A1, ..., An - 1.","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10113F"},"statements":[{"statement_type":"Markdown","content":"GukiZ loves hiking in the mountains. He starts his hike at the height 0 and he has some goal to reach, initially equal to h.\n\nThe mountains are described by a sequence of integers A0, A1, ..., An - 1. In the first day GukiZ will change his height by A0, in the second day by A1, and so on. Mountains are a regular structure so the pattern repeats after the first n days. In general, in the i-th day GukiZ will change his height by A(i - 1)%n.\n\nAdditionally, GukiZ will become more and more tired and in the i-th day his goal will decrease by i. For example, after first three days his goal will be equal to h - 1 - 2 - 3 = h - 6.\n\nNote that A may contain negative elements, what represents going down from some hill. Moreover, GukiZ's height may become negative, and so does his goal!\n\nYou can assume that both GukiZ's height and goal change at the same moment (immediately and simultaneously) in the middle of a day.\n\nOnce GukiZ is at the height not less than his goal, he ends his hike. Could you calculate the number of days in his hike?\n\nThe first line of the input contains two integers n and h (1 ≤ n ≤ 105, 1 ≤ h ≤ 109) — the length of the array A and the initial goal, respectively. \n\nThe second line contains n integers A0, A1, ..., An - 1 ( - 109 ≤ Ai ≤ 109).\n\nIn a single line print the number of days in the GukiZ's hike.\n\nIt can be proved that for any valid input the answer exists.\n\nGukiZ starts at height 0 with goal 45. We can describe his hike as follows:\n\nAfter the 7-th day Gukiz's height is not less than his goal so he ends his hike.\n\n## Input\n\nThe first line of the input contains two integers n and h (1 ≤ n ≤ 105, 1 ≤ h ≤ 109) — the length of the array A and the initial goal, respectively. The second line contains n integers A0, A1, ..., An - 1 ( - 109 ≤ Ai ≤ 109).\n\n## Output\n\nIn a single line print the number of days in the GukiZ's hike.It can be proved that for any valid input the answer exists.\n\n[samples]\n\n## Note\n\nGukiZ starts at height 0 with goal 45. We can describe his hike as follows:  After the first day he is at height 7 and his goal is 44.  Height 3, goal 42.  Height 8, goal 39.  Height 15, goal 35.  Height 11, goal 30.  Height 16, goal 24.  Height 23, goal 17. After the 7-th day Gukiz's height is not less than his goal so he ends his hike.","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $ be the length of the cycle array.  \nLet $ h \\in \\mathbb{Z}^+ $ be the initial goal.  \nLet $ A = (A_0, A_1, \\dots, A_{n-1}) \\in \\mathbb{Z}^n $ be the array of daily height changes.  \n\nLet $ H_d \\in \\mathbb{Z} $ denote GukiZ’s height after $ d $ days.  \nLet $ G_d \\in \\mathbb{Z} $ denote GukiZ’s goal after $ d $ days.  \n\n**Initial Conditions**  \n$ H_0 = 0 $,  \n$ G_0 = h $.  \n\n**Transition Rules**  \nFor each day $ d \\geq 1 $:  \n- $ H_d = H_{d-1} + A_{(d-1) \\bmod n} $,  \n- $ G_d = G_{d-1} - d $.  \n\n**Objective**  \nFind the smallest positive integer $ d $ such that:  \n$$\nH_d \\geq G_d\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10113F","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}