N, K = list(map(int, input().split(" "))) S = input() r = False if N % 2 == 0 and K % 2 == 0: r = True elif N % 2 != 0 and K % 2 != 0: r = True S_f = S[0:K-1] S_e = S[K-1:] if r: S_f = S_f[::-1] print(S_e+S_f)