def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,K=MI()
    S=input()
    
    ans=""
    ans+=S[K-1:]
    T=S[0:K-1]
    if (N-K+1)%2==0:
        ans+=T
    else:
        ans+=T[::-1]
    print(ans)


main()