import sys readline=sys.stdin.readline write=sys.stdout.write from math import gcd as GCD import math def main(N,K): lst=[i for i in range(N)] for i in range(N-K+1): lst[i:i+K]=lst[i:i+K][::-1] return lst N,K=map(int,readline().split()) S=readline().rstrip() if K%2: ans=S[K-1:]+S[:K-1] else: ans=S[K-1:]+S[:K-1][::-1] print(ans)