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