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