#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 17 | 10;
int n, m, a[N], seg[4 * N];
void change(int p, int x, int id = 1, int st = 0, int en = 1 << n,
            int t = n & 1) {
  if (en - st == 1) {
    seg[id] = x;
    return;
  }
  int mid = (st + en) >> 1;
  if (p < mid)
    change(p, x, id << 1, st, mid, t ^ 1);
  else
    change(p, x, id << 1 | 1, mid, en, t ^ 1);
  if (t)
    seg[id] = seg[id << 1] | seg[id << 1 | 1];
  else
    seg[id] = seg[id << 1] ^ seg[id << 1 | 1];
}
void build(int id = 1, int st = 0, int en = 1 << n, int t = n & 1) {
  if (en - st == 1) {
    seg[id] = a[st];
    return;
  }
  int mid = (st + en) >> 1;
  build(id << 1, st, mid, t ^ 1);
  build(id << 1 | 1, mid, en, t ^ 1);
  if (t)
    seg[id] = seg[id << 1] | seg[id << 1 | 1];
  else
    seg[id] = seg[id << 1] ^ seg[id << 1 | 1];
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < 1 << n; i++) cin >> a[i];
  build();
  while (m--) {
    int p, x;
    cin >> p >> x;
    change(--p, x);
    cout << seg[1] << endl;
  }
  return 0;
}
