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])
  i=u.rfind(u[0])
  *u,=u
  for i in range(i,min(n,i+k)):u[i]=u[0]
  print(f(''.join(u[::-1]+u)))