#include <bits/stdc++.h>
using namespace std;
class SegFind {
 private:
  vector<long long> st;
  long long lg;

 public:
  SegFind(vector<long long> a, long long n) {
    lg = log2(n);
    st = vector<long long>(2 * n);
    init(a, n);
  }
  void init(vector<long long> a, long long n) {
    for (long long i = 0; i < n; i++) st[i + n] = a[i];
    for (long long i = n - 1; i > 0; i--) {
      long long first = log2(i);
      first = lg - first;
      if (first & 1)
        st[i] = (st[i << 1] | st[i << 1 | 1]);
      else
        st[i] = (st[i << 1] ^ st[i << 1 | 1]);
    }
  }
  void update(long long p, long long n, long long v) {
    for (st[p += n] = v; p > 1; p >>= 1) {
      long long first = log2(p >> 1);
      first = lg - first;
      if (first & 1)
        st[p >> 1] = (st[p] | st[p ^ 1]);
      else
        st[p >> 1] = (st[p] ^ st[p ^ 1]);
    }
  }
  long long quary(long long l, long long r, long long n) {
    long long ans = 0;
    for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
      if (l & 1) {
        long long first = log(l);
        first = lg - first;
        if (first & 1)
          ans = (ans | st[l++]);
        else
          ans = (ans ^ st[l++]);
      }
      if (r & 1) {
        long long first = log(r);
        first = lg - first;
        if (first & 1)
          ans = (ans | st[--r]);
        else
          ans = (ans ^ st[--r]);
      }
    }
    return ans;
  }
  long long FindV() { return st[1]; }
  void echoTree() {
    for (auto it : st) cout << it << " ";
    cout << '\n';
  }
  void echoArr(long long n) {
    for (long long i = n; i < 2 * n; i++) cout << st[i] << " ";
    cout << '\n';
  }
};
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, q;
  cin >> n >> q;
  n = 1 << n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  SegFind tree(a, n);
  while (q--) {
    long long p, v;
    cin >> p >> v;
    tree.update(p - 1, n, v);
    cout << tree.FindV() << '\n';
  }
  return 0;
}
