#include using namespace std; #define rep(i,n) for(int i = 0; i < (n);i++) #define sz(x) int(x.size()) typedef long long ll; typedef long double ld; typedef pair P; typedef pair PL; constexpr int INF = 2e9; int main() { int n, q; cin >> n >> q; vector a(n); rep(i,n) cin >> a[i]; vector cumulative_xor(n + 1, 0); for (int i = 0; i < n; i++) cumulative_xor[i + 1] = cumulative_xor[i] ^ a[i]; while (q--) { int l, r; cin >> l >> r; cout << (cumulative_xor[r] ^ cumulative_xor[l - 1]) << endl; } return 0; }