#include <bits/stdc++.h>
using namespace std;
struct biencay {
  int l, r;
  int gt;
  int tang;
};
biencay cay[700000];
int n, m, tgn;
int vtdoi, gt;
int mu2[20], a[140000];
void xet(int vt) {
  if (cay[vt].tang % 2 == tgn % 2)
    cay[vt].gt = cay[vt * 2].gt | cay[vt * 2 + 1].gt;
  else
    cay[vt].gt = cay[vt * 2].gt ^ cay[vt * 2 + 1].gt;
}
void taocay(int vt, int l, int r, int tang) {
  cay[vt].l = l;
  cay[vt].r = r;
  cay[vt].tang = tang;
  if (l == r) {
    cay[vt].gt = a[l];
    return;
  }
  int m = (l + r) / 2;
  taocay(vt * 2, l, m, tang + 1);
  taocay(vt * 2 + 1, m + 1, r, tang + 1);
  xet(vt);
}
void solve(int vt) {
  if (cay[vt].l > vtdoi || cay[vt].r < vtdoi) return;
  if (cay[vt].l == vtdoi && cay[vt].r == vtdoi) {
    cay[vt].gt = gt;
    return;
  }
  solve(vt * 2);
  solve(vt * 2 + 1);
  xet(vt);
}
void output() { printf("%d\n", cay[1].gt); }
int main() {
  mu2[0] = 1;
  for (int i = 1; i <= 17; i++) {
    mu2[i] = mu2[i - 1] * 2;
  }
  while (scanf("%d %d", &n, &m) > 0) {
    tgn = n;
    n = mu2[n];
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    taocay(1, 1, n, 1);
    for (int i = 0; i < m; i++) {
      scanf("%d %d", &vtdoi, &gt);
      solve(1);
      output();
    }
  }
  return 0;
}
