#include <bits/stdc++.h>
using namespace std;
long long x, y, n, m, k;
long long a[105][105], d[105][105];
int main() {
  cin >> n >> k;
  string s;
  cin >> s;
  string ans = s;
  char c = 'z';
  for (int i = 0; i < n; i++) {
    c = min(c, s[i]);
  }
  if (k >= 15) {
    for (int i = 0; i < n; i++) {
      cout << c;
    }
    cout << endl;
    return 0;
  }
  string t = s;
  reverse(t.begin(), t.end());
  s.append(t);
  k--;
  long long cnt = 0, cur = 0;
  for (int i = 0; i < 2 * n; i++) {
    if (s[i] == c) {
      cur++;
    } else {
      cnt = max(cnt, cur);
      cur = 0;
    }
  }
  cnt = max(cnt, cur);
  long long lf = (cnt << k);
  if ((cnt << k) >= n) {
    for (int i = 0; i < n; i++) {
      cout << c;
    }
    cout << endl;
    return 0;
  }
  cur = 0;
  string ending = "";
  for (int i = 0; i < 2 * n; i++) {
    if (i + (n - lf) >= 2 * n) {
      break;
    }
    if (s[i] == c) {
      cur++;
    } else {
      cur = 0;
    }
    if (cur == cnt && i >= n) {
      string tmp;
      for (int j = i + 1; j <= i + (n - lf); j++) {
        tmp.push_back(s[j]);
      }
      if (ending == "") {
        ending = tmp;
      } else if (tmp < ending) {
        ending = tmp;
      }
    }
  }
  for (int i = 0; i < lf; i++) {
    cout << c;
  }
  cout << ending << endl;
  return 0;
}
