Permutation#4079

Permutation

1 second
128 megabytes
Very easy

A permutation of the first positive integers is given as an array. For each query, determine the smallest index of the array that contains a number from the segment inclusive.

Input

The first line contains two integers and q~(1 \le n, q \le 10^5) — the size of the permutation and the number of queries, respectively.

The second line contains a permutation of distinct integers from to .

Each of the next lines contains two integers and v~(1 \le u \le v \le 10^5), defining the boundaries of the segment.

Output

For each query, print the smallest index of the array that contains a number from the segment . Print the answers one per line.

Examples

Example 1

Loading
Loading