f=lambda s:min(s[i:i+n]for i in range(n+1))
n,k=map(int,input().split())
s=input()
if k<2:print(f(s+s[::-1]))
elif k>n:print(min(s)*n)
else: 
  *u,=f(s+s[::-1])
  for i in range(k-1):u[i]=u[0]
  print(f(''.join(u[::-1]+u)))