#include <bits/stdc++.h>
using namespace std;
long long A[1 << 18], As;
bool B[1 << 18];
void up(int idx, int l, int r, int lx, int rx, int v) {
  if (l > rx || r < lx) return;
  if (l == lx && r == rx) {
    A[idx] = v;
    B[idx] = 1;
    return;
  }
  int m = (l + r) / 2;
  up(idx * 2, l, m, lx, rx, v);
  up(idx * 2 + 1, m + 1, r, lx, rx, v);
  if (B[idx * 2] && B[idx * 2 + 1])
    B[idx] = 0, A[idx] = A[idx * 2] | A[idx * 2 + 1];
  else
    B[idx] = 1, A[idx] = A[idx * 2] ^ A[idx * 2 + 1];
}
long long qy(int idx, int l, int r, int lx, int rx) {
  if (l > rx || r < lx) return 0;
  if (l >= lx && r <= rx) return A[idx];
  int m = (l + r) / 2;
  long long a1 = qy(idx * 2, l, m, lx, rx);
  long long a2 = qy(idx * 2 + 1, m + 1, r, lx, rx);
  if (B[idx * 2] && B[idx * 2 + 1])
    return a1 | a2;
  else
    return a1 ^ a2;
}
int main() {
  int n, m, x, y;
  scanf("%d %d", &n, &m);
  y = (1 << n);
  for (int i = 0; i < y; i++) scanf("%d", &x), up(1, 0, y - 1, i, i, x);
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &n, &x);
    up(1, 0, y - 1, n - 1, n - 1, x);
    As = qy(1, 0, y - 1, 0, y - 1);
    printf("%I64d\n", As);
  }
}
