import sys
n,k = map(int,input().split( ))
s = input()
r0 = list(reversed(s))
r = ''.join(r0)
s = s + r
l = len(s)
S = [s[i] for i in range(l)]

literal=list(set(S))
literal.sort()

small = literal[0]

i=0
mx=0
cnt = 0
now=-1
cnd=[]
while i<l:
    if s[i] == small:
        now = i
        cnt = 1
        i += 1
        try:
            while s[i] == small:
                cnt += 1
                i += 1
            if mx < cnt:
                cnd = []
                cnd.append(now)
                now == i
                mx = cnt
            elif mx == cnt:
                cnd.append(now)
                now = i
            else:
                now = i
        except:
            pass
    i += 1
if mx*2**k>=n:
    print(small*2**k)
    sys.exit
else:
    pass
cnd_string = []
addi = n - 2**k


for i in cnd:
    cnd_string.append(s[i + mx : i + mx + addi])
cnd_string.sort()
for t in cnd_string:
    if len(t) < addi:
        cnd_string.remove(t)
print(small*2**k + cnd_string[0])
