- Time limit: 1.00 s
- Memory limit: 512 MB
There are buildings in a row numbered from left to right. You are standing to the left of the first building. You can see a building if it is taller than any building to its left.
Your task is to process queries: If only buildings in range existed, how many buildings would you see?
Input
The first line has two integers and : the number of buildings and queries.
The second line has integers : the heights of the buildings.
Finally, there are lines describing the queries. Each line has two integers and .
Output
For each query, print one integer: the number of visible buildings.
Constraints
Example
Input:
5 3 4 1 2 2 3 1 5 2 5 3 4
Output:
1 3 1