#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 17;
int arr[N], tree[N << 1];
int n;
void build(int ni = 0, int ns = 0, int ne = n - 1) {
  if (ns == ne) {
    tree[ni] = arr[ns];
    return;
  }
  int lf = 2 * ni + 1, rt = lf + 1, mid = ns + (ne - ns) / 2;
  build(lf, ns, mid);
  build(rt, mid + 1, ne);
  if (int(log2(ne - ns + 1)) % 2 != 0)
    tree[ni] = tree[lf] | tree[rt];
  else
    tree[ni] = tree[lf] ^ tree[rt];
}
int update(int idx, int val, int ni = 0, int ns = 0, int ne = n - 1) {
  if (idx > ne || idx < ns) return 0;
  if (ns == ne) {
    tree[ni] = val;
    return val;
  }
  int lf = 2 * ni + 1, rt = lf + 1, mid = ns + (ne - ns) / 2;
  update(idx, val, lf, ns, mid);
  update(idx, val, rt, mid + 1, ne);
  if (int(log2(ne - ns + 1)) % 2 != 0)
    return tree[ni] = tree[lf] | tree[rt];
  else
    return tree[ni] = tree[lf] ^ tree[rt];
}
int main() {
  int q;
  scanf("%d%d", &n, &q);
  n = (1 << n);
  for (int i = 0; i < n; ++i) scanf("%d", &arr[i]);
  build();
  while (q--) {
    int idx, val;
    scanf("%d%d", &idx, &val);
    printf("%d\n", update(idx - 1, val));
  }
}
