#include <bits/stdc++.h>
using namespace std;
int READ_INT() {
  int temp;
  cin >> temp;
  return temp;
}
long long int READ_LONG() {
  long long int temp;
  cin >> temp;
  return temp;
}
string READ_STRING() {
  string temp;
  cin >> temp;
  return temp;
}
const long double phi = 3.14159265358979323846;
const long long INF = 1e+17;
const long N = 1e+5;
long long int inverse(long long int i) {
  if (i == 1) return 1;
  return (1000000007 -
          ((1000000007 / i) * inverse(1000000007 % i)) % 1000000007 +
          1000000007) %
         1000000007;
}
long long int POW(long long int a, long long int b) {
  if (b == 0) return 1;
  if (b == 1) return a % 1000000007;
  long long int temp = POW(a, b / 2);
  if (b % 2 == 0)
    return (temp * temp) % 1000000007;
  else
    return (((temp * temp) % 1000000007) * a) % 1000000007;
}
bool issorted(vector<int>& arr) {
  if (arr.size() <= 1) return 1;
  for (int i = 1; i < arr.size(); ++i) {
    if (arr[i] < arr[i - 1]) return false;
  }
  return true;
}
bool isSquare(int x) {
  int y = (int)(sqrt(x));
  while (y * y < x) y++;
  while (y * y > x) y--;
  return y * y == x;
}
const int s = (1 << 17) + 7;
int t[4 * s], h[4 * s], p, x;
void build(int v, int left, int right) {
  if (right == left) {
    h[v] = 1;
  } else {
    int m = (left + right) >> 1;
    build(2 * v, left, m);
    build(2 * v + 1, m + 1, right);
    h[v] = 1 + h[2 * v];
  }
}
void update(int v, int left, int right, int p, int x) {
  if (left > p || right < p) return;
  if (right == left) {
    t[v] = x;
  } else {
    int m = (left + right) >> 1;
    update(2 * v, left, m, p, x);
    update(2 * v + 1, m + 1, right, p, x);
    if (h[v] % 2 == 0) {
      t[v] = (t[2 * v] | t[2 * v + 1]);
    } else {
      t[v] = (t[2 * v] ^ t[2 * v + 1]);
    }
  }
}
void Ra09() {
  int n, q;
  cin >> n >> q;
  n = (1 << n);
  build(1, 1, n);
  for (int i = 1; i <= n; i++) {
    cin >> x;
    update(1, 1, n, i, x);
  }
  while (q--) {
    cin >> p >> x;
    update(1, 1, n, p, x);
    cout << t[1] << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int test;
  test = 1;
  for (int t = 1; t <= test; t++) {
    Ra09();
  }
}
