#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long power(long long a, long long n) {
  long long ans = 1;
  while (n) {
    if (n % 2) ans = (ans * a) % mod;
    n = n / 2;
    a = (a * a) % mod;
  }
  return ans;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, q;
  cin >> n >> q;
  n = (1 << n);
  vector<long long> a(n);
  vector<vector<long long>> V;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  V.push_back(a);
  long long i = n;
  long long k = 0;
  while (i > 1) {
    vector<long long> temp;
    for (long long j = 0; j < i; j += 2) {
      if (k % 2 == 0) {
        long long x = V[k][j] | V[k][j + 1];
        temp.push_back(x);
      } else {
        long long x = V[k][j] ^ V[k][j + 1];
        temp.push_back(x);
      }
    }
    V.push_back(temp);
    k++;
    i = i / 2;
  }
  while (q--) {
    long long p, b;
    cin >> p >> b;
    p--;
    long long k = 0;
    V[k][p] = b;
    while (k < V.size() - 1) {
      if (k % 2 == 0) {
        if (p % 2) {
          b = b | V[k][p - 1];
        } else {
          b = b | V[k][p + 1];
        }
      } else {
        if (p % 2) {
          b = b ^ V[k][p - 1];
        } else {
          b = b ^ V[k][p + 1];
        }
      }
      k++;
      p = p / 2;
      V[k][p] = b;
    }
    cout << b << "\n";
  }
  return 0;
}
