n,k=map(int,input().split()) s=input() r=n-k+1 if r%2==0: s=s[n-r:]+s[:n-r] else: nw=''.join(list(reversed(s[:n-r]))) s=s[n-r:]+nw print(s)