def main(): N, K = map( int, input().split()) S = input() ans = S[K-1:] T = S[:K-1] if (N-K)%2 == 1: ans += T else: ans += T[::-1] print(ans) if __name__ == '__main__': main()