n,k = map(int,input().split()) s = input() for i in range(n): print(s[(k+i-1)%n],end='')