//#pragma GCC optimize ("O2")
//#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
#include<cstdio>
#include<cstring>
#include<bitset>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += 72 - dig >> 3;
	return tmp;
}
const int MAX = 1000;
class shuturyoku_unko {
public:
	char C[MAX * 4];
	constexpr shuturyoku_unko() : C() {
		rep(i, MAX) {
			int X = i;
			rep(j, 3) {
				C[i * 4 + 2 - j] = '0' + X % 10;
				X /= 10;
			}
			C[i * 4 + 3] = '\n';
		}
	}
};
constexpr shuturyoku_unko f;
const int dm = 1 << 17;
char dn[dm], * di = dn, * owad = dn + dm - 20;
void putint(int A) {
	if (owad < di) {
		fwrite(dn, 1, di - dn, stdout);
		di = dn;
	}
	if (A >= 1000) {
		int dig = 1;
		if (A >= 100000) dig = 3;
		else if (A >= 10000) dig = 2;
		memcpy(di, f.C + A / 1000 * 4 + 3 - dig, dig);
		memcpy(di + dig, f.C + A % 1000 * 4, 4);
		di += dig + 4;
	}
	else {
		int dig = 1;
		if (A >= 100) dig = 3;
		else if (A >= 10) dig = 2;
		memcpy(di, f.C + A * 4 + 3 - dig, dig + 1);
		di += dig + 1;
	}
}
bitset<200010> A;
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int N = getint();
	int kotae = 0;
	rep(i, N) {
		A[getint()] = 1;
		while (A[kotae]) kotae++;
		putint(kotae);
	}
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}
// https://atcoder.jp/contests/abc185/tasks/abc185_f

#include <bits/stdc++.h>
using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DEBUG 0
#if DEBUG
  #define _GLIBCXX_DEBUG
  #define DUMP(a) REP(_i, a.size()) cout << a[_i] << (_i + 1 == a.size() ? "\n" : " ")
  #define DUMP2D(b) REP(_j, b.size()) DUMP(b[_j]); cout << endl
#else
  #define DUMP(a)
  #define DUMP2D(b)
#endif

//------------------------------------------------------------------------------
#define LF(i)   (n - 1 + i)
#define PA(k)   ((k - 1) / 2)
#define LC(k)   (k * 2 + 1)
#define RC(k)   (k * 2 + 2)
#define M(l,r)  ((l + r) / 2)

template<typename T> class SegTree {
public:
  int n;
  int sz;
  T def;
  vector<T> dat;

  void init(int _n, T _def) {
    n = 1; while (n < _n) n <<= 1;
    sz = n * 2 - 1;
    def = _def;
    dat.resize(sz, def);
  }

  void update(int i, T x) {
    int k = LF(i);
    dat[k] ^= x;
    while (k > 0) {
      k = PA(k);
      dat[k] = dat[LC(k)] ^ dat[RC(k)];
    }
  }

  T query(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return def;
    if (a <= l && r <= b) return dat[k];
    T vl = query(a, b, LC(k), l, M(l, r));
    T vr = query(a, b, RC(k), M(l, r), r);
    return vl ^ vr;
  }

  T query(int a, int b) {
    return query(a, b, 0, 0, n);
  }

  void dump() {
    REP(i, sz) printf("%d%c", dat[i], i + 1 == sz ? '\n' : ' ');
  }
};

//------------------------------------------------------------------------------
const int N_MAX = 300000;
const int Q_MAX = 300000;
const int A_I_MAX = 1<<30;
const int Y_I_MAX = 1<<30;

int N, Q;
vector<int> A;
vector<int> T;
vector<int> X;
vector<int> Y;

SegTree<int> st;

int main() {
  cin >> N >> Q;
  A = vector<int>(N);
  REP(i, N) cin >> A[i];
  T = vector<int>(Q);
  X = vector<int>(Q);
  Y = vector<int>(Q);
  REP(i, Q) cin >> T[i] >> X[i] >> Y[i];

  st.init(N, 0);
  REP(i, N) st.update(i, A[i]);
  REP(i, Q) {
    if (T[i] == 1) {
      st.update(X[i] - 1, Y[i]);
    }
    if (T[i] == 2) {
      cout << st.query(X[i] - 1, Y[i]) << endl;
    }
  }
}
