#include "bits/stdc++.h" using namespace std; typedef long long ll; const int INF = (1<<30); const ll INFLL = (1ll<<60); const ll MOD = (ll)(1e9+7); #define l_ength size void mul_mod(ll& a, ll b){ a *= b; a %= MOD; } void add_mod(ll& a, ll b){ a = (a1){ update(p,l,(l+r)>>1,i*2+1); update(p,(l+r)>>1,r,i*2+2); vl = segtree[i*2+1]; vr = segtree[i*2+2]; if(a[vl] < a[vr]){ segtree[i] = vl; }else{ segtree[i] = vr; } }else{ segtree[i] = p; } } int query(int p, int q, int l=0, int r=n, int i=0){ int vl,vr; if(q<=l || r<=p){ return n; } if(r-l>1){ vl = query(p,q,l,(l+r)>>1,i*2+1); vr = query(p,q,(l+r)>>1,r,i*2+2); if(a[vl] < a[vr]){ return vl; }else{ return vr; } }else{ return segtree[i]; } } int main(void){ int q,i,t,l,r; scanf("%d%d",&n,&q); fill(a,a+n,INF); a[n] = INF; for(i=0; i