#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
const int N = 200010;
int a[N], n, m;
struct SegmentTree{
int id;
int dat;
int l,r;
}t[N<<2];
int build(int p, int l, int r){
t[p].l = l, t[p].r = r;
if(t[p].l == t