#include <bits/stdc++.h>
using namespace std;
int N;
int a[1 << 18];
int tree[1 << 20];
void build(int i, int tl, int tr, int level) {
  if (tl > tr) return;
  if (tl == tr) {
    tree[i] = a[tl];
    return;
  }
  int mid = (tl + tr) >> 1;
  build(i + i, tl, mid, level + 1);
  build(i + i + 1, mid + 1, tr, level + 1);
  if ((N - level) & 1) {
    tree[i] = tree[i + i] | tree[i + i + 1];
  } else
    tree[i] = tree[i + i] ^ tree[i + i + 1];
}
void update(int i, int tl, int tr, int pos, int val, int level) {
  if (tl > tr || tl > pos || tr < pos) return;
  if (tl == tr) {
    tree[i] = val;
    return;
  }
  int mid = (tl + tr) >> 1;
  if (pos > mid)
    update(i + i + 1, mid + 1, tr, pos, val, level + 1);
  else
    update(i + i, tl, mid, pos, val, level + 1);
  if ((N - level) & 1)
    tree[i] = tree[i + i] | tree[i + i + 1];
  else
    tree[i] = tree[i + i] ^ tree[i + i + 1];
}
int main() {
  int n, q;
  cin >> n >> q;
  N = n;
  for (int i = 0; i < (1 << n); i++) cin >> a[i];
  build(1, 0, (1 << n) - 1, 0);
  while (q--) {
    int pos, val;
    cin >> pos >> val;
    pos--;
    update(1, 0, (1 << n) - 1, pos, val, 0);
    cout << tree[1] << endl;
  }
}
