Under construction

Still being built. Things may change

Irritable Bowel Syndrome

Time limit2sMemory limit1024 MB

Summary
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 NN days are given as A1,⋯ ,ANA_1,\cdots ,A_N. If Ai≥0A_i \ge 0, then AiA_i units of stress build up on day ii. If Ai<0A_i < 0, then −Ai-A_i units of stress are relieved on day ii. The stress level is 00 when observation begins. If the amount of stress relieved is greater than the stress accumulated so far, the stress decreases only until it reaches 00.

Sangwon gets a stomachache on any day when the accumulated stress is at least MM. Find the number of days Sangwon suffers from stomachaches.

Input

The first line contains NN and MM, the number of days the stress changes were observed and the amount of stress that causes a stomachache.

The second line contains A1,A2,⋯ ,ANA_1, A_2, \cdots ,A_N separated by spaces.

Output

Print the number of days on which Sangwon gets a stomachache.

Constraints

  • 1≤N≤1051\leq N\leq 10^5
  • 1≤M≤1091\leq M\leq 10^9
  • −104≤Ai≤104(1≤i≤N)-10^4\leq A_i\leq 10^4 (1\le i\le N)
  • All input numbers are integers.

Examples2

  1. Example 1

    Input
    10 10
    2 -1 4 7 4 -8 3 6 4 -7
    
    Expected output
    6
    
  2. Example 2

    Input
    5 1
    1 -1 -1 -1 1
    
    Expected output
    2