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