Irritable Bowel Syndrome
Time limit2sMemory limit1024 MB
Given daily stress changes where positive values add stress and negative values relieve it down to 0, count the days the accumulated stress is at least M.
- Level
Easy2 of 10
- Topics
- Simulation, Implementation
- Solved
- No attempts yet
Problem
Sangwon has irritable bowel syndrome. The cause of irritable bowel syndrome is stress!
The daily stress changes over days are given as . If , then units of stress build up on day . If , then units of stress are relieved on day . The stress level is when observation begins. If the amount of stress relieved is greater than the stress accumulated so far, the stress decreases only until it reaches .
Sangwon gets a stomachache on any day when the accumulated stress is at least . Find the number of days Sangwon suffers from stomachaches.
Input
The first line contains and , the number of days the stress changes were observed and the amount of stress that causes a stomachache.
The second line contains separated by spaces.
Output
Print the number of days on which Sangwon gets a stomachache.
Constraints
- All input numbers are integers.