import sys input=lambda: sys.stdin.readline().rstrip() n,k=map(int,input().split()) S=input() ans=S[k-1:] if (n-k+1)%2==0: ans+=S[:k-1] else: ans+=S[:k-1][::-1] print(ans)