Ciruclar shift and Intersection of two arrays