CSES - Visible Buildings Queries
  • Time limit: 1.00 s
  • Memory limit: 512 MB

There are nn buildings in a row numbered 1,2,,n1, 2,\dots, n 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 qq queries: If only buildings in range [a,b][a, b] existed, how many buildings would you see?

Input

The first line has two integers nn and qq: the number of buildings and queries.

The second line has nn integers h1,h2,,hnh_1, h_2, \dots, h_n: the heights of the buildings.

Finally, there are qq lines describing the queries. Each line has two integers aa and bb.

Output

For each query, print one integer: the number of visible buildings.

Constraints

  • 1n1051 \le n \le 10^5
  • 1q21051 \le q \le 2 \cdot 10^5
  • 1hi1091 \le h_i \le 10^9
  • 1abn1 \le a \le b \le n

Example

Input:

5 3
4 1 2 2 3
1 5
2 5
3 4

Output:

1
3
1