#include <bits/stdc++.h>
using namespace std;
const long long int MAXN = (1 << 18);
struct SegTree {
  long long int val, op;
};
SegTree segtree[MAXN << 2];
long long int A[MAXN];
long long int n;
inline long long int left(long long int x) { return (x << 1); }
inline long long int right(long long int x) { return (x << 1) + 1; }
void build(long long int node, long long int l, long long int r) {
  if (l == r) {
    segtree[node].val = A[r];
    segtree[node].op = 1;
  } else {
    long long int md = ((r + l) >> 1);
    build(left(node), l, md);
    build(right(node), md + 1, r);
    if (segtree[left(node)].op == 1)
      segtree[node].val = (segtree[left(node)].val | segtree[right(node)].val);
    else
      segtree[node].val = (segtree[left(node)].val ^ segtree[right(node)].val);
    segtree[node].op = segtree[left(node)].op * (-1);
  }
}
void update(long long int node, long long int l, long long int r,
            long long int x, long long int value) {
  if (l == r)
    segtree[node].val = value;
  else {
    long long int md = (l + r) / 2;
    if (x <= md)
      update(left(node), l, md, x, value);
    else
      update(right(node), md + 1, r, x, value);
    if (segtree[left(node)].op == 1)
      segtree[node].val = (segtree[left(node)].val | segtree[right(node)].val);
    else
      segtree[node].val = (segtree[left(node)].val ^ segtree[right(node)].val);
  }
}
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  long long int m, x, y;
  cin >> n >> m;
  map<long long int, long long int> cnt;
  for (long long int i = 0; i < (1 << n); i++) {
    cin >> A[i];
    cnt[i] = A[i];
  }
  build(1, 0, (1 << n) - 1);
  while (m--) {
    cin >> x >> y;
    if (cnt[x - 1] != y) {
      update(1, 0, (1 << n) - 1, x - 1, y);
      cnt[x - 1] = y;
    }
    cout << segtree[1].val << "\n";
  }
  return 0;
}
