#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
const i64 MOD = 1e9 + 7;
signed main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  if (k >= 64) {
    char c = *min_element(s.begin(), s.end());
    for (int i = 0; i < n; ++i) cout << c;
    cout << endl;
  }
  for (int i = 0; i < k; ++i) {
    string s_ = s;
    reverse(s_.begin(), s_.end());
    s += s_;
    string t = "~";
    for (int i = 0; i < n; ++i) t = min(t, s.substr(i, n));
    s = move(t);
  }
  cout << s << endl;
}
