an identity permutation length n array 1 2 3 dot nwe perform follow operation identity permutation length n firstly cyclically shift right k position k unknown thing know 0 le k le n 1 when array cyclically shift right k position result array form take k element original array change relative order append n k element right change relative order n k element for example cyclically shift identity permutation length 6 2 position array 5 6 1 2 3 4 secondly perform follow operation m time pick element array swap you give value n m result array your task find possible value k cyclic shift operation