n,k = map(int,input().split()) S = input() if (n-k)%2: print(S[k-1:]+S[:k-1]) else: print(S[k-1:]+S[:k-1][::-1])