#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const int N = 2e5 + 10;
int arr[N];
int prefixXor[N];
int main() {
int n, q;
cin >> n >> q;
for (int i = 1; i <= n; i++) {
cin >> arr[i];
prefixXor[i] = prefixXor[i - 1] ^ arr[i];
}
while (q--) {
int l, r;
cin >> l >> r;
cout << (prefixXor[r] ^ prefixXor[l - 1]) << endl;
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBsbCBsb25nIGxvbmcgaW50CmNvbnN0IGludCBOID0gMmU1ICsgMTA7CmludCBhcnJbTl07CmludCBwcmVmaXhYb3JbTl07CmludCBtYWluKCkgewoJaW50IG4sIHE7CgljaW4gPj4gbiA+PiBxOwoJZm9yIChpbnQgaSA9IDE7IGkgPD0gbjsgaSsrKSB7CgkJY2luID4+IGFycltpXTsKCQlwcmVmaXhYb3JbaV0gPSBwcmVmaXhYb3JbaSAtIDFdIF4gYXJyW2ldOwoJfQoJd2hpbGUgKHEtLSkgewoJCWludCBsLCByOwoJCWNpbiA+PiBsID4+IHI7CiAKCQljb3V0IDw8IChwcmVmaXhYb3Jbcl0gXiBwcmVmaXhYb3JbbCAtIDFdKSA8PCBlbmRsOwoJfQoJcmV0dXJuIDA7Cn0=