Under construction

Still being built. Things may change

Cords

Interview

Time limit1sMemory limit128 MB

Summary
Partition the row of cords into the maximum number of contiguous groups with total length at least w.
Level

Easy3 of 10

Topics
Greedy, Array
Solved
No attempts yet

Statement

Jaś received nn cords from his grandfather and laid them out in a straight line, one next to another. Any two adjacent cords can be joined into a single cord whose length equals the sum of the two lengths. A cord formed this way can be joined again with an adjacent cord.

Jaś wants every cord he is left with to be at least as long as his own height ww, while keeping as many cords as possible. Because only adjacent cords may be joined, each final cord is the concatenation of a contiguous block of the original cords.

Find the maximum number of cords Jaś can end up with. If joining all of the cords into one still gives a length shorter than ww, then no valid arrangement exists, so output 00.

Input

The first line contains two integers nn and ww (1≤n,w≤1061 \le n, w \le 10^6), the number of cords and Jaś's height.

The second line contains nn integers a1,a2,…,ana_1, a_2, \dots, a_n (1≤ai≤1061 \le a_i \le 10^6), the lengths of the cords from left to right.

Output

Print a single integer: the maximum number of cords Jaś can obtain, where every cord has length at least ww.

Examples1

  1. Example 1

    Input
    8 4
    1 2 3 4 8 1 1 3
    
    Expected output
    4