#include <iostream>
usingnamespace std;
int main() {
int n, m;
cin >> n >> m;
int t[n];
for(int i = 0; i < n; i++){
cin >> t[i];
}
for(int i = 0; i < m; i++){
int a, b, aux = 0;
cin >> a >> b;
for(int j = a-1; j <= b-1; j++){
aux ^= t[j];
}
cout << aux << endl;
}
}
#include <iostream>
usingnamespace std;
int main()
{
int n, m;
cin >> n >> m;
int *t = newint[n];
for ( int i = 0; i < n; i++ ) cin >> t[i];
int *xort = newint[n];
xort[0] = t[0];
for ( int i = 1; i < n; i++ ) xort[i] = xort[i-1] ^ t[i];
int a, b;
while ( m-- )
{
cin >> a >> b; // I'm guessing that a and b are one-based
if ( a == 1 ) cout << xort[b-1] << '\n';
else cout << ( xort[b-1] ^ xort[a-2] ) << '\n';
}
delete [] t;
delete [] xort;
}