Typical!
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 to
. 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 .
Say , and the fight counts look like:
1 3 5 6 2 3 7 1 2 1
The "high-crime" zones here are bars through
, and bars
through
. 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,
, the number of bars on Hindley street, and
the number of fights required in a bar to be included in your news report.
The next lines contain integers,
, the number of fights that break out at each of the bars
to
.
Output
Report all the ranges of bars with at least 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
fights.
Example
Input 1
5 4
1 5 2 4 9
Output 1
2 2
4 5
Bars ,
and
have at least
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