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