#Q7. 「一本通 1.1 练习 2」数列分段

「一本通 1.1 练习 2」数列分段

Description

Given a positive integer sequence AiA_i of length NN, it needs to be divided into contiguous segments such that the sum of each segment does not exceed MM (it can be equal to MM). The task is to find the minimum number of segments required to meet this condition.

Input Format

The first line contains two positive integers NN and MM, representing the length of the sequence AiA_i and the maximum allowed sum for each segment.

The second line contains NN space-separated non-negative integers AiA_i.

Output Format

The output file should contain a single positive integer, which is the minimum number of segments required.

Sample 1

5 6
4 2 4 5 1

3

Data Range and Hints

For 20%20\% of the data, N10N\le 10;

For 40%40\% of the data, N1000N\le 1000;

For 100%100\% of the data, N105N\le 10^5, M109M\le 10^9, and MM is greater than the maximum value in the sequence.