#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
void buildxor(long long *arr, long long *tree, int start, int end, int i);
void buildor(long long *arr, long long *tree, int start, int end, int i) {
  if (start == end) {
    tree[i] = arr[start];
    return;
  }
  int mid = (start + end) / 2;
  buildxor(arr, tree, start, mid, 2 * i);
  buildxor(arr, tree, mid + 1, end, 2 * i + 1);
  tree[i] = tree[2 * i] | tree[2 * i + 1];
}
void buildxor(long long *arr, long long *tree, int start, int end, int i) {
  if (start == end) {
    tree[i] = arr[start];
    return;
  }
  int mid = (start + end) / 2;
  buildor(arr, tree, start, mid, (i << 1));
  buildor(arr, tree, mid + 1, end, (i << 1) + 1);
  tree[i] = tree[2 * i] ^ tree[(i << 1) + 1];
}
void update(long long *tree, int p);
void updatex(long long *tree, int p) {
  if (p == 0) return;
  tree[p / 2] = tree[2 * (p / 2)] ^ tree[2 * (p / 2) + 1];
  update(tree, p / 2);
}
void update(long long *tree, int p) {
  if (p == 0) return;
  tree[p / 2] = tree[2 * (p / 2)] | tree[2 * (p / 2) + 1];
  updatex(tree, p / 2);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, node = 1;
  cin >> n >> m;
  long long arr[1 << n], tree[1 << (n + 1)];
  for (__typeof(1 << n) i = (0) - (0 > 1 << n); i != (1 << n) - (0 > 1 << n);
       i += 1 - 2 * (0 > 1 << n))
    cin >> arr[i];
  if (n & 1)
    buildor(arr, tree, 0, (1 << n) - 1, node);
  else
    buildxor(arr, tree, 0, (1 << n) - 1, node);
  while (m--) {
    int p, b;
    cin >> p >> b;
    arr[p - 1] = b;
    tree[(1 << n) + p - 1] = b;
    update(tree, (1 << n) + p - 1);
    cout << tree[1] << '\n';
  }
  return 0;
}
