N,K=map(int,input().split())

S=input()

print(S[K-1:]+S[:K-1] if (N-K+1)%2 == 0 else S[K-1:]+S[:K-1][::-1])