~/algor $ cat problems/qidiruv-burilgan-massiv
Search in a rotated array
An array of distinct integers sorted in increasing order was cut at one place into two parts, and the parts were swapped (for example, 3 6 9 12 15 18 22 became 15 18 22 3 6 9 12; the array may also be left uncut). This array $a$ and $q$ queries are given. Each query gives an integer $x$: at which position of the array is it? If it is not in the array, print $-1$.
Input
The first line contains two positive integers: $n$ and $q$.
The second line contains $n$ integers $a_{i}$.
Each of the next $q$ lines contains one integer $x$.
Output
For each query on a separate line: the position number or $-1$.
Note
$1 \le n, q \le 10^{5}$
$-10^{9} \le a_{i}, x \le 10^{9}$
all $a_{i}$ are distinct
Examples
7 3 15 18 22 3 6 9 12 6 22 10
5 3 -1
1 2 4 4 7
1 -1