#P169. 【例28.3】 数列分段

【例28.3】 数列分段

Description

Given a sequence of positive integers aia_i of length nn, divide it into consecutive segments such that the sum of each segment does not exceed mm (can be equal to mm). Find the minimum number of segments needed to satisfy this requirement.

Input Format

The first line contains two positive integers nn and mm, representing the length of the sequence and the maximum sum allowed for each segment.
The second line contains nn non-negative integers aia_i separated by spaces.
Constraints: 1n1051≤n≤10^5, 1aim1041≤a_i≤m≤10^4.

Output Format

Output a single positive integer representing the minimum number of segments needed.

Sample

5 6
4 2 4 5 1
3