#OLD393. Kingdom Intelligent Agency

Kingdom Intelligent Agency

Description

Kingdom C's rival, Kingdom A, was conducting military exercises during this period.So the C Kingdom agent Mosu started working.Kingdom A has arranged n soldier camps along the coastline. The task of Mosu is to monitor the activities of these soldier camps. Because of some advanced testing methods, the number of C soldiers in each soldier camp is very clear, the number of people in each soldier camp may change, and several people may be added or reduced, but these will not escape the surveillance of Kingdom C.The CIA wants to study what tactics the enemy is doing.The CIA gave Mosu QQ questions. Each question has two numbers, ll and rr, indicate how many types of engineering camps exist in the interval [1,l][1,l]and [r,n][r, n]. ps:Equal numbers are considered to be the same type.

Format

Input

The first line contains two numbers NN and QQ, and the second line contains nn numbers, each of which is aia_i, indicating that there are aia_i soldiers in the ii soldier camp.

The next QQ lines each contains two numbers, ll and rr for the query(1n,q,ai<=2×105)1\leq n,q,a_i<=2×10^5)

Output

Each line contains a number that is the result of the query.

Samples

3 2
1 2 1
1 2
1 3
2
1

Hint