N, Q = gets.split(" ").map{|s| s.to_i} a = gets.split(" ").map{|s| s.to_i} q = [] Q.times { q << gets.split(" ").map(&:to_i) } s = [0] a.each {|x| s << s[-1] ^ x } ans = [] q.each {|l, r| ans << s[l-1] ^ s[r] } puts ans