#include <bits/stdc++.h>
long long getn() {
  char r;
  bool start = false, neg = false;
  long long int ret = 0;
  while (true) {
    r = getchar();
    if ((r - '0' < 0 || r - '0' > 9) && r != '-' && !start) {
      continue;
    }
    if ((r - '0' < 0 || r - '0' > 9) && r != '-' && start) {
      break;
    }
    if (start) ret *= 10;
    start = true;
    if (r == '-')
      neg = true;
    else
      ret += r - '0';
  }
  if (!neg)
    return ret;
  else
    return -ret;
}
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 = getn(), m = getn(), p;
  n = 1 << n;
  for (int i = 1; i <= n; i++) {
    a[n + i - 1] = getn();
    solve(n + i - 1);
  }
  for (; m; m--) {
    p = getn();
    a[n + p - 1] = getn();
    solve(n + p - 1);
    printf("%d\n", a[1]);
  }
  return 0;
}
