#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 5, MOD = 1e9 + 7, MAXN = 1e5, LG = 20, M = 1e7, P = 727,
          Sq = 100;
const long long inf = 1e18 + 10;
string wh[N];
int seg[N], lg, m;
void update(int s, int e, int ind) {
  if (wh[ind] == "or")
    seg[ind] = (seg[(2 * (ind))] | seg[((2 * (ind)) + 1)]);
  else
    seg[ind] = (seg[(2 * (ind))] ^ seg[((2 * (ind)) + 1)]);
  return;
}
void add(int s, int e, int ind, int l, int r, int val) {
  if (s >= l && e <= r) {
    seg[ind] = val;
    return;
  }
  int mid = (s + e) / 2;
  if (l < mid) add(s, mid, (2 * (ind)), l, r, val);
  if (r > mid) add(mid, e, ((2 * (ind)) + 1), l, r, val);
  update(s, e, ind);
}
void make_fill(int s, int e, int ind) {
  if (e == s + 1) {
    wh[ind] = "xor";
    return;
  }
  int mid = (s + e) / 2;
  make_fill(s, mid, (2 * (ind)));
  make_fill(mid, e, ((2 * (ind)) + 1));
  if (wh[(2 * (ind))] == "or")
    wh[ind] = "xor";
  else
    wh[ind] = "or";
  return;
}
int main() {
  scanf("%d%d", &lg, &m);
  int n = (1 << lg);
  make_fill(1, n + 1, 1);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    add(1, n + 1, 1, i, i + 1, x);
  }
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(1, n + 1, 1, x, x + 1, y);
    printf("%d\n", seg[1]);
  }
  return 0;
}
