#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a>n>>q; vector as(n); for(int i=0;i>as[i]; for(int i=0;i>t; assert(t==1); { int l,r; cin>>l>>r; l--; int val=-1,num=0; for(int j=l;j