Problem: You come home and fell some unpleasant smell. Where is it coming from?

You are given an array a. You have to answer the following queries: 

  1. You are given two integers l and r. Let ci be the number of occurrences of i in al: r, where al: r is the subarray of a from l-th element to r-th inclusive. Find the Mex of {c0, c1, ..., c109}
  2. You are given two integers p to x. Change ap to x. 



The Mex of a multiset of numbers is the smallest non-negative integer not in the set.

Note that in this problem all elements of a are positive, which means that c0 = 0 and 0 is never the answer for the query of the second type.

Input

The first line of input contains two integers n and q (1 ≤ n, q ≤ 100 000) — the length of the array and the number of queries respectively.

The second line of input contains n integers — a1, a2, ..., an (1 ≤ ai ≤ 109).

Each of the next q lines describes a single query.

The first type of query is described by three integers ti = 1, li, ri, where 1 ≤ li ≤ ri ≤ n — the bounds of the subarray.

The second type of query is described by three integers ti = 2, pi, xi, where 1 ≤ pi ≤ n is the index of the element, which must be changed and 1 ≤ xi ≤ 109 is the new value.

Output

For each query of the first type output a single integer — the Mex of {c0, c1, ..., c109}.

Example

Input

10 4
1 2 3 1 1 2 2 2 9 9
1 1 1
1 2 8
2 7 1
1 2 8


Output

2
3
2

Note

The subarray of the first query consists of the single element — 1. 

The subarray of the second query consists of four 2s, one 3 and two 1s.

The subarray of the fourth query consists of three 1s, three 2s and one 3.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC target("avx")
using namespace std;
const int inf = ~0u >> 1, mod = 1e9 + 7;
struct Frw {
  char *TT, *mo, but[(1 << 15) + 2], butt[(1 << 15) + 2], *bp, *bq;
  Frw() { bp = butt, bq = butt + (1 << 15); }
  ~Frw() { fwrite(butt, 1, bp - butt, stdout); }
  inline operator int() {
    int x;
    {
      char c, f = 1;
      while (!isdigit(
          c = ((TT == mo &&
                (mo = ((TT = but) + fread(but, 1, 1 << 15, stdin)), TT == mo))
                   ? -1
                   : *TT++)))
        f = c != '-';
      x = c - '0';
      while (isdigit(
          c = ((TT == mo &&
                (mo = ((TT = but) + fread(but, 1, 1 << 15, stdin)), TT == mo))
                   ? -1
                   : *TT++)))
        x = x * 10 + c - '0';
      return f ? x : -x;
    };
  }
  inline void pr(char x) {
    *bp = x;
    (++bp == bq) ? fwrite(butt, 1, 1 << 15, stdout), bp = butt : 0;
  }
  inline void operator()(int x) {
    if (!x) return pr('0'), pr('\n');
    if (x < 0) pr('-'), x = -x;
    static int s[12];
    int p = 0;
    while (x) s[p++] = x % 10, x /= 10;
    for (int i = (p - 1), i_st = (0); i >= i_st; --i) pr(s[i] + '0');
    pr('\n');
  }
} it;
const int N = 1e5 + 11;
int n, m;
int a[N], C[2 * N];
int b[N], bel[N];
map<int, int> Mp;
struct Node {
  int l, r, id, x;
  bool operator<(const Node &t) const {
    return bel[l] != bel[t.l] ? l < t.l
                              : (bel[r] != bel[t.r] ? r < t.r : x < t.x);
  }
} q[N];
int X[N], Y[N], Z[N], ans[N];
int L, R, T, cnt;
inline void Del(int x) { b[C[x]]--, b[--C[x]]++; }
inline void Ins(int x) { b[C[x]]--, b[++C[x]]++; }
inline void change(int i) {
  if (X[i] <= R && X[i] >= L) {
    Del(a[X[i]]);
    Ins(Y[i]);
  }
  Z[i] = a[X[i]];
  a[X[i]] = Y[i];
}
inline void chang1(int i) {
  if (X[i] <= R && X[i] >= L) {
    Del(a[X[i]]);
    Ins(Z[i]);
  }
  a[X[i]] = Z[i];
}
int main() {
  n = it, m = it;
  int S = 3400;
  for (int i = (1), i_end = (n); i <= i_end; ++i) bel[i] = (i - 1) / S;
  for (int i = (1), i_end = (n); i <= i_end; ++i) a[i] = it;
  for (int i = (1), i_end = (n); i <= i_end; ++i) {
    if (!Mp[a[i]]) Mp[a[i]] = ++cnt;
    a[i] = Mp[a[i]];
  }
  int cur1 = 0, cur2 = 0;
  for (int i = (1), i_end = (m); i <= i_end; ++i) {
    int op = it, l = it, r = it;
    if (op == 1)
      ++cur1, q[cur1] = (Node){l, r, cur1, cur2};
    else {
      if (!Mp[r]) Mp[r] = ++cnt;
      X[++cur2] = l, Y[cur2] = Mp[r];
    }
  }
  L = 1, R = 1, T = 0;
  C[a[1]] = 1, b[1] = 1;
  sort(q + 1, q + cur1 + 1);
  for (int i = (1), i_end = (cur1); i <= i_end; ++i) {
    for (int j = (T + 1), j_end = (q[i].x); j <= j_end; ++j) change(j);
    for (int j = (T), j_st = (q[i].x + 1); j >= j_st; --j) chang1(j);
    T = q[i].x;
    while (R < q[i].r) Ins(a[++R]);
    while (R > q[i].r) Del(a[R--]);
    while (L < q[i].l) Del(a[L++]);
    while (L > q[i].l) Ins(a[--L]);
    for (int j = 1;; j++)
      if (!b[j]) {
        ans[q[i].id] = j;
        break;
      }
  }
  for (int i = (1), i_end = (cur1); i <= i_end; ++i) it(ans[i]);
}