/*
author: kartik8800
*/
#include<bits/stdc++.h>
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long
using namespace std;
int main()
{
fast_io;
int t,i,j,n,ans,q;
cin>>n>>q;
vector<int> ar(n);
vector<int> pref_xor(n);
for(int i = 0; i < n; i++)
cin >> ar[i];
pref_xor[0] = ar[0];
for(int i = 1; i < n; i++)
pref_xor[i] = pref_xor[i-1]^ar[i];
while(q--)
{
int u,v;
cin >> u >> v;
u--; v--;
if(u==0)
cout<<pref_xor[v]<<'\n';
else cout<<(pref_xor[v]^pref_xor[u-1])<<'\n';
}
return 0;
}
LyoKICAgIGF1dGhvcjoga2FydGlrODgwMAoqLwojaW5jbHVkZTxiaXRzL3N0ZGMrKy5oPgojZGVmaW5lIGZhc3RfaW8gaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7Y2luLnRpZShOVUxMKQojZGVmaW5lIGxsIGxvbmcgbG9uZwp1c2luZyBuYW1lc3BhY2Ugc3RkOwogCmludCBtYWluKCkKewogICAgZmFzdF9pbzsKICAgIGludCB0LGksaixuLGFucyxxOwogCiAgICBjaW4+Pm4+PnE7CiAgICB2ZWN0b3I8aW50PiBhcihuKTsKICAgIHZlY3RvcjxpbnQ+IHByZWZfeG9yKG4pOwogICAgZm9yKGludCBpID0gMDsgaSA8IG47IGkrKykKICAgICAgICBjaW4gPj4gYXJbaV07CiAKICAgIHByZWZfeG9yWzBdID0gYXJbMF07CiAgICBmb3IoaW50IGkgPSAxOyBpIDwgbjsgaSsrKQogICAgICAgIHByZWZfeG9yW2ldID0gcHJlZl94b3JbaS0xXV5hcltpXTsKIAogICAgd2hpbGUocS0tKQogICAgewogICAgICAgIGludCB1LHY7CiAgICAgICAgY2luID4+IHUgPj4gdjsKICAgICAgICB1LS07IHYtLTsKICAgICAgICBpZih1PT0wKQogICAgICAgICAgICBjb3V0PDxwcmVmX3hvclt2XTw8J1xuJzsKICAgICAgICBlbHNlIGNvdXQ8PChwcmVmX3hvclt2XV5wcmVmX3hvclt1LTFdKTw8J1xuJzsKICAgIH0KIAogICAgcmV0dXJuIDA7Cn0=