n, k = map(int, input().split())
s = input()
u = s + s[::-1]
t = min(u[i:i + n] for i in range(n + 1))
i, h = 0, t[0]
for i in range(n):
    if t[i] != h:
        break
j = i
for _ in range(k - 1):
    j <<= 1
    if j >= n:
        print(h * n)
        break
else:
    print(h * j + t[i:i + n - j])
