n, k = read_line.split.try { |(n, k)| {n.to_i, k.to_i64} } a = read_line.split.map(&.to_i64) a << a.reduce { |i, j| i ^ j } puts a[k.pred % a.size]