#include <bits/stdc++.h>
using namespace std;
vector<long long int> tree;
vector<long long int> arr;
void build(int node = 0, int start = 0, int end = arr.size() - 1) {
  if (start == end) {
    tree[node] = arr[start];
    return;
  }
  build(2 * node + 1, start, (start + end) / 2);
  build(2 * node + 2, (start + end) / 2 + 1, end);
  int sz = end - start + 1;
  int k = 0;
  while (sz > 1) {
    k++;
    sz /= 2;
  }
  if (k % 2 == 1) {
    tree[node] = tree[2 * node + 1] | tree[2 * node + 2];
  } else {
    tree[node] = tree[2 * node + 1] ^ tree[2 * node + 2];
  }
}
void update(int index, long long int val, int node = 0, int start = 0,
            int end = arr.size() - 1) {
  if (index > end || index < start) return;
  if (start == end) {
    tree[node] = val;
    arr[start] = val;
    return;
  }
  update(index, val, 2 * node + 1, start, (start + end) / 2);
  update(index, val, 2 * node + 2, (start + end) / 2 + 1, end);
  int sz = end - start + 1;
  int k = 0;
  while (sz > 1) {
    k++;
    sz /= 2;
  }
  if (k % 2 == 1) {
    tree[node] = tree[2 * node + 1] | tree[2 * node + 2];
  } else {
    tree[node] = tree[2 * node + 1] ^ tree[2 * node + 2];
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  tree = vector<long long int>(4 * (1 << n));
  arr = vector<long long int>((1 << n));
  for (int i = 0; i < (1 << n); i++) {
    cin >> arr[i];
  }
  build();
  while (m--) {
    long long int a, b;
    cin >> a >> b;
    update(a - 1, b);
    cout << tree[0] << "\n";
  }
  return 0;
}
