The input consists of several test cases.
The first line of each test case contains two integer n, m, indicating the number of rabbits and the queries.
The following line contains n integers, and the i-th integer Wi indicates the weight of the i-th rabbit.
Then m lines follow. Each line represents a query. It contains two integers L and R, meaning the king wanted to ask about the situation that if he sent all rabbits from the L-th one to the R-th one into prison.
(1 <= n, m, Wi <= 200000, 1 <= L <= R <= n)
The input ends with n = 0 and m = 0.