#include <iostream>
#include <vector>
using namespace std;
const int N = 1e5 + 5;
int A[N], P[N], P_map[N];
vector<int> segTree(4 * N);
// ... (rest of the code remains the same)
int main() {
int N, Q;
cin >> N >> Q;
for (int i = 1; i <= N; i++) {
cin >> P[i];
P_map[P[i]] = i;
}
// ... (rest of the code remains the same)
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmNvbnN0IGludCBOID0gMWU1ICsgNTsKCmludCBBW05dLCBQW05dLCBQX21hcFtOXTsKdmVjdG9yPGludD4gc2VnVHJlZSg0ICogTik7CgovLyAuLi4gKHJlc3Qgb2YgdGhlIGNvZGUgcmVtYWlucyB0aGUgc2FtZSkKCmludCBtYWluKCkgewogICAgaW50IE4sIFE7CiAgICBjaW4gPj4gTiA+PiBROwogICAgZm9yIChpbnQgaSA9IDE7IGkgPD0gTjsgaSsrKSB7CiAgICAgICAgY2luID4+IFBbaV07CiAgICAgICAgUF9tYXBbUFtpXV0gPSBpOwogICAgfQoKICAgIC8vIC4uLiAocmVzdCBvZiB0aGUgY29kZSByZW1haW5zIHRoZSBzYW1lKQoKICAgIHJldHVybiAwOwp9