The input consists of several test cases and is terminated by end-of-file.
The first line of each test cases contains two integers n and q.
The second line contains n integers a1, a2, ..., an.
The i-th of the following q lines contains two integers li and ri.
For each test case, print q integers which denote the result.
3 2 1 2 1 1 2 1 3 4 1 1 2 3 4 1 3
2 1 3
* 1 ≤ n, q ≤ 105
* 1 ≤ ai ≤ n
* 1 ≤ li, ri ≤ n
* The number of test cases does not exceed 10.

这道题你会答吗?花几分钟告诉大家答案吧!