#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 questions. Each question has two numbers, and , indicate how many types of engineering camps exist in the interval and . ps:Equal numbers are considered to be the same type.
Format
Input
The first line contains two numbers and , and the second line contains numbers, each of which is , indicating that there are soldiers in the soldier camp.
The next lines each contains two numbers, and for the query(
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