Typical!


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C++, Java, Python

Hindley Street is the place to be if you're after clubs, bars, and live music. It's also a great place to see your typical bar fight.

Each bar is numbered from 1 to n. Every night, Channel 9 News dutifully reports the number of fights that break out at each bar. This can take hours, and as a Hindley Street local, you're getting sick of it!

So, you call Channel 9 to complain. Shockingly, they fire back!

"Think you can do better? Prove it!"

Just like that, they invite you to take over crime reporting for the night. But, you've got a plan. Instead of listing the number of fights at every bar, you'll report only the "high-crime" zones: continuous stretches of bars where the number of fights are at least k.

Say k = 3, and the fight counts look like:

1 3 5 6 2 3 7 1 2 1

The "high-crime" zones here are bars 2 through 4, and bars 6 through 7. You'd report them as:

2 4
6 7

Do you have what it takes? It's time to knock Channel 9's socks off!

Input

The first line contains two integers, n (1 \leq n \leq 10^5), the number of bars on Hindley street, and k (1 \leq k \leq 10^9) the number of fights required in a bar to be included in your news report.

The next lines contain n integers, F_i (1 \leq F_i \leq 10^9), the number of fights that break out at each of the bars 1 to n.

Output

Report all the ranges of bars with at least k fights. Ranges should be in sorted order and each range should be printed on its own line.

Clarifications

  • At least 1 bar will have at least k fights.

Example

Input 1
5 4
1 5 2 4 9
Output 1
2 2
4 5

Bars 2, 4 and 5 have at least 4 fights. These can be summarised into two ranges.

Input 2
12 15
15 20 25 30 10 10 20 25 10 15 15 15
Output 2
1 4
7 8
10 12
Input 3
10 1
1 1 1 1 1 1 1 1 1 1
Output 3
1 10

Comments

There are no comments at the moment.