#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;
}