CSES - Distinct Values Queries
  • Time limit: 1.00 s
  • Memory limit: 512 MB

You are given an array of nn integers and qq queries of the form: how many distinct values are there in a range [a,b][a,b]?

Input

The first input line has two integers nn and qq: the array size and number of queries.

The next line has nn integers x1,x2,,xnx_1,x_2,\dots,x_n: the array values.

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

Output

For each query, print the number of distinct values in the range.

Constraints

  • 1n,q21051 \le n,q \le 2 \cdot 10^5
  • 1xi1091 \le x_i \le 10^9
  • 1abn1 \le a \le b \le n

Example

Input:

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

Output:

2
3
3