Obada is Osama's brother, and a former teammate of Tareq too. Do you know what that means? You guessed it, the Blender of Standards again. Obada is a bit smarter than Osama. He can make problems using the Blender that does not actually look like a Blender problem.
Obada will give you an Obada-utiful Graph. It's a graph that is given in a weird way.
It's an undirected graph with $$$N$$$ vertices given as a permutation $$$P$$$ such that there is an undirected edge between vertices $$$u$$$ and $$$v$$$ if:
The first line of the input contains two integers $$$N$$$ and $$$Q$$$ ($$$1 \le N \le 10^5$$$), ($$$1 \le Q \le 10^5$$$) — the number of vertices in the graph and the number of queries.
The second line contains $$$N$$$ distinct integers $$$P_1, P_2, \dots, P_N$$$ $$$(1 \le P_i \le N)$$$ — the permutation $$$P$$$.
Each of the next $$$Q$$$ lines contain two integers $$$i$$$ and $$$j$$$ $$$(1 \le i \lt j \le N)$$$ — the description of the queries.
For each query print a single line — the number of connected components in the graph after the first $$$i$$$ queries.
3 2 1 2 3 1 3 2 3
3 2
Sample explanation:
| Name |
|---|


