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