#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int MOD = 1000000007;
int aray[1 << 17];
class SST {
 public:
  int d, v;
  SST* ch[2];
  SST(int d, int loc) : d(d) {
    if (d) {
      ch[0] = new SST(d - 1, loc);
      ch[1] = new SST(d - 1, loc | (1 << (d - 1)));
      if (d % 2)
        v = ch[0]->v | ch[1]->v;
      else
        v = ch[0]->v ^ ch[1]->v;
    } else
      v = aray[loc];
  }
  ~SST() {
    if (ch[0]) delete ch[0];
    if (ch[1]) delete ch[1];
  }
  void inc(int i, int v0) {
    if (!d) {
      v = v0;
      return;
    }
    bool cv = i & (1 << (d - 1));
    ch[cv]->inc(i, v0);
    if (d % 2)
      v = ch[0]->v | ch[1]->v;
    else
      v = ch[0]->v ^ ch[1]->v;
  }
};
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = (0); i < (1 << n); i++) cin >> aray[i];
  SST* s = new SST(17, 0);
  while (m--) {
    int i, v;
    cin >> i >> v;
    s->inc(i - 1, v);
    cout << s->v << endl;
  }
}
