#include <bits/stdc++.h>
using namespace std;
const int N = 5005;
const int INF = 1000000000;
int n, k;
char s[N], flag = 0;
int ans[N], cac[N];
void update() {
  if (!flag) {
    for (int i = 1; i <= n; i++) ans[i] = cac[i];
    flag = 1;
    return;
  }
  bool ok = 0;
  for (int i = 1; i <= n; i++) {
    if (cac[i] < ans[i]) {
      ok = 1;
      break;
    }
    if (cac[i] > ans[i]) {
      ok = -1;
      break;
    }
  }
  if (ok != 1) return;
  for (int i = 1; i <= n; i++) ans[i] = cac[i];
}
int main() {
  scanf("%d %d", &n, &k);
  scanf("%s", s + 1);
  int minc = INF;
  for (int i = 1; i <= n; i++) {
    minc = min(minc, s[i] - 'a');
  }
  int tmp = 1;
  int cnt = (s[1] - 'a' == minc), mxl = 1;
  for (int j = 1; j <= k - 1; j++) {
    tmp *= 2;
    if (tmp >= n) {
      for (int i = 1; i <= n; i++) {
        putchar(char(minc + 'a'));
      }
      return 0;
    }
  }
  int mxminc = 0;
  for (int i = 1; i <= n; i++) {
    if (i == 1)
      cnt = 0;
    else if (s[i] != s[i - 1])
      cnt = 0;
    cnt += (s[i] - 'a' == minc);
    if (cnt == 0) continue;
    if (i == n) {
      int tmpl = tmp * cnt * 2;
      if (tmpl > n) {
        for (int i = 1; i <= n; i++) {
          putchar(char(minc + 'a'));
        }
        return 0;
      }
      for (int i = 1; i <= tmpl; i++) cac[i] = minc;
      int pos = n - cnt;
      for (int i = tmpl + 1; i <= n; i++) {
        cac[i] = s[pos] - 'a';
        pos--;
      }
      update();
    } else {
      int tmpl = tmp * cnt;
      if (tmpl > n) {
        for (int i = 1; i <= n; i++) {
          putchar(char(minc + 'a'));
        }
        return 0;
      }
      for (int i = 1; i <= tmpl; i++) cac[i] = minc;
      int pos = i + 1;
      for (int i = tmpl + 1; i <= n; i++) {
        if (pos <= n)
          cac[i] = s[pos] - 'a';
        else
          cac[i] = s[2 * n + 1 - pos] - 'a';
        pos++;
      }
      update();
    }
  }
  for (int i = 1; i <= n; i++) putchar(char(ans[i] + 'a'));
  return 0;
}
