#include <bits/stdc++.h>
int a[2 * 131072];
void solve(int i) {
  for (int j = i >> 1, k = 1; j; j >>= 1, k ^= 1) {
    if (k)
      a[j] = a[j << 1] | a[j << 1 | 1];
    else
      a[j] = a[j << 1] ^ a[j << 1 | 1];
  }
}
int main() {
  int n, m, p;
  scanf("%d%d", &n, &m);
  n = 1 << n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[n + i - 1]);
    solve(n + i - 1);
  }
  for (; m; m--) {
    scanf("%d", &p);
    scanf("%d", &a[n + p - 1]);
    solve(n + p - 1);
    printf("%d\n", a[1]);
  }
  return 0;
}
