Under construction

Still being built. Things may change

Postcard

Interview

Time limit1sMemory limit512 MB

Summary
Count the contiguous segments that keep at least one mountain of height m or more after trimming both ends.
Level

Easy3 of 10

Topics
Combinatorics, Array
Solved
No attempts yet

Problem

During his winter holiday in the mountains, Wojtek bought a huge postcard showing a mountain panorama. Back home he framed it and hung it on the wall to admire every day, but after a few weeks he grew tired of the view.

Just as the souvenir was about to be stored away in the attic, Wojtek had a clever idea: cut off a few mountains from the left and a few from the right to obtain a new, more striking panorama. If he cuts away too much, though, the new view could look dull, so he wants at least one mountain of height at least mm to remain after cutting.

The mountains stand in a row. Removing 00 or more from the left and 00 or more from the right leaves a contiguous segment of mountains in the middle. Among all such segments (two compositions are different when the position range of the remaining mountains differs), count how many are non-empty and contain at least one mountain of height at least mm. The case where Wojtek cuts nothing and leaves the postcard unchanged also counts, as long as it contains a mountain of height at least mm.

Input

The first line contains two integers nn and mm (1≤n≤1 000 0001 \le n \le 1\,000\,000, 1≤m≤1 000 000 0001 \le m \le 1\,000\,000\,000), separated by a single space. They denote the number of mountains on the postcard and the minimum height of a mountain that makes the panorama striking, respectively.

The second line contains nn integers hih_i (1≤hi≤1 000 000 0001 \le h_i \le 1\,000\,000\,000), separated by single spaces. They are the heights of the mountains from left to right, and all heights are distinct (hi≠hjh_i \ne h_j for i≠ji \ne j).

Output

Print a single integer: the number of compositions that satisfy the conditions.

Hint

For example, if the heights from the left are 80 102 90 98 100 and m=100m = 100, the following eleven compositions satisfy the conditions.

80 102 90 98 100
102 90 98 100
90 98 100
98 100
100
80 102 90 98
80 102 90
80 102
102 90 98
102 90
102

Examples1

  1. Example 1

    Input
    5 100
    80 102 90 98 100
    
    Expected output
    11