class Lca: # 最近共通祖先 def __init__(self, E, root): import sys sys.setrecursionlimit(500000) self.root = root self.E = E # V self.n = len(E) # 頂点数 self.logn = 1 # n < 1<= (1<= 0: self.parent[k+1][v] = self.parent[k][p_] def dfs(self, v, p, dep): # ノード番号、親のノード番号、深さ self.parent[0][v] = p self.depth[v] = dep for e in self.E[v]: if e != p: self.dfs(e, v, dep+1) def get(self, u, v): if self.depth[u] > self.depth[v]: u, v = v, u # self.depth[u] <= self.depth[v] dep_diff = self.depth[v]-self.depth[u] for k in range(self.logn): if dep_diff >> k & 1: v = self.parent[k][v] if u==v: return u for k in range(self.logn-1, -1, -1): if self.parent[k][u] != self.parent[k][v]: u = self.parent[k][u] v = self.parent[k][v] return self.parent[0][u] N, Q = map(int, input().split()) A = list(map(int, input().split())) E = [[] for _ in range(N+1)] st = [] # 中身は常に降順 for i, a in enumerate(A): while st: i_, a_ = st.pop() if a_ < a: E[i].append(i_) E[i_].append(i) else: st.append((i_, a_)) break st.append((i, a)) for s, a in st: E[N].append(s) E[s].append(N) lca = Lca(E, N) # parent[n][v] = ノード v から 1<>= 1 Ans.append(ans+1) print("\n".join(map(str, Ans)))