cswork / OAOpen practice workspace

Wells FargoOA #4

Compressing Array

Estimated MediumJudge-ready

Topics (AI-labelled)Greedy

You may repeatedly merge two adjacent elements, replacing them with their product; a merge is allowed only when the product is ≤k. All elements are positive integers. Find the shortest array length reachable after any sequence of operations.

Input

The first line contains n and k; the second line contains n positive integers a[i]. The original constraints are corrupted; this site adds: 1≤n≤200000, 1≤a[i]≤10^9, 1≤k≤10^18.

Output

Output the shortest possible length.

Example 1

Input:

6 20
2 3 3 7 3 5

Output:

3

Example 2

Input:

3 5
2 4 5

Output:

3

Example 3

Input:

3 1
1 1 1

Output:

1

Editorial

Loading solution…