#include <bits/stdc++.h>

using namespace std;

int main() {
   ios_base::sync_with_stdio(false);
   int N, K;
   string S;
   cin >> N >> K >> S;
   K = min(K, 15);
   S += string(S.rbegin(), S.rend());
   string ans = S.substr(0, N);
   for (int z = 0; z <= N; ++z) {
      ans = min(ans, S.substr(z, N));
   }
   int cnt = 0;
   while (cnt < N && ans[cnt] == ans[0]) cnt++;
   string head = ans.substr(0, cnt);
   string tail = ans.substr(cnt);
   for (int z = 0; z < K - 1; ++z) {
      head += head;
      if (head.size() > N) {
         head.resize(N);
      }
   }
   ans = head + tail;
   ans.resize(N);
   cout << ans << "\n";
   return 0;
}
