- Time limit: 1.00 s
- Memory limit: 512 MB
There are skyscrapers in a row. The sun illuminates some of the skyscrapers from the left: a skyscraper is in the sun if it is higher than any skyscraper to the left.
Your task is to process queries where each query has some range . If we assume that only the skyscrapers in the range exist, how many of them are in the sun?
Input
The first input line has two integers and : the number of skyscrapers and queries. The skyscrapers are numbered .
The second line has integers : the heights of the skyscrapers.
Finally, there are lines, each having two integers and (): the range of the query is .
Output
For each query, print one integer: the number of skyscrapers in the sun.
Example
Input:
5 3 4 1 2 2 3 1 5 2 5 3 4
Output:
1 3 1