N,K = map(int, input().split(' ')) S = input() S = S[K-1:] + S[:K-1][::([-1,1][(N-K)%2==1])] print(S)