Given an array of size , support the of the following queries:
Count the number of elements appearing exactly once in the range .
Constraints
Input Specification
The first line contains integers and .
The second line contains integers , the elements of .
The next lines each contain integers and , representing a query on the range .
Output Specification
For each query output one integer on its own line, the answer to that query.
Sample Input
7 5
1 2 3 2 4 3 1
2 5
1 7
4 7
3 6
1 1
Sample Output
2
1
4
2
1
Comments