import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, K = map(int, readline().split()) S = read().rstrip().decode() L = S[: K - 1] R = S[K - 1:] if (N - K) & 1: L = L[::-1] S = R + L print(R + L)