Gleb Evstropov

아직 제출이 없습니다시간 제한20초메모리 제한512 MB

문제

You are given an array aa.

Process two types of queries:

  1. You are given xx and yy. Set a_xa\_x to yy.
  2. You are given ll, rr and kk. Find the largest value of mm, such that sequence k,k+1,,mk, k+1, \ldots, m is a subsequence of a_l:ra\_{l:r}.

입력

The first line contains two integers nn and qq (1n,q1061 \leq n, q \leq 10^6), the length of aa and the number of queries, respectively.

The second line contains nn integers a_ia\_i (0a_i<n0 \leq a\_i < n), the elements of aa.

qq lines follow. Each of them has one of the following forms:

  • 1xy1 x y (0x,y<n0 \leq x, y < n), describing a query of the first type.
  • 2lrk2 l r k (0l<rn0 \leq l < r \leq n, 0k<n0 \leq k < n), describing a query of the second type. Note that half-intervals are used, i.e. a_0:3a\_{0:3} contains elements with indices 00, 11 and 22. It is guaranteed that the given half-interval contains at least one element equal to kk.

출력

For each query of the second type print the corresponding mm.