#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 233;
char s[maxn];
int sa[maxn], t[maxn * 2], t2[maxn * 2], c[maxn], n, m, rk[maxn];
inline bool equal(int *y, int a, int b, int k) {
  if (y[a] != y[b]) return 0;
  if (y[a + k] != y[b + k]) return 0;
  return 1;
}
void suffix_array() {
  int *x = t, *y = t2;
  m = 'z' + 1;
  for (int i = 0; i < n; i++) {
    sa[i] = i;
    x[i] = s[i];
  }
  for (int i = n; i < 2 * n; i++) t[i] = t2[i] = -1;
  for (int k = 0; k <= n; k = k == 0 ? 1 : k << 1) {
    int p = 0;
    for (int i = n - k; i < n; i++) y[p++] = i;
    for (int i = 0; i < n; i++)
      if (sa[i] >= k) y[p++] = sa[i] - k;
    for (int i = 0; i < m; i++) c[i] = 0;
    for (int i = 0; i < n; i++) c[x[y[i]]]++;
    for (int i = 0; i < m; i++) c[i] += c[i - 1];
    for (int i = n - 1; i >= 0; i--) sa[--c[x[y[i]]]] = y[i];
    swap(x, y);
    p = 1;
    x[sa[0]] = 0;
    for (int i = 1; i < n; i++) {
      int t = equal(y, sa[i], sa[i - 1], k);
      if (t)
        x[sa[i]] = p - 1;
      else
        x[sa[i]] = p++;
    }
    if (p > n) break;
    m = p;
  }
  for (int i = 0; i < n; i++) rk[sa[i]] = i;
  return;
}
int main() {
  int k;
  cin >> n >> k;
  scanf("%s", s);
  int mini = 10000;
  for (int i = 0; i < n; i++) {
    s[n + i] = s[n - i - 1];
    mini = min(mini, (int)s[i]);
  }
  int maxi = 0;
  n *= 2;
  for (int i = 0; i < n; i++) {
    if (s[i] != mini) continue;
    int j = i + 1;
    while (j < n && s[j] == s[i]) j++;
    maxi = max(maxi, j - i);
    i = j - 1;
  }
  long long v = maxi;
  v *= k;
  if (v >= n / 2) {
    for (int i = 1; i <= n / 2; i++) putchar(mini);
    return 0;
  }
  v -= maxi;
  int res = n / 2;
  for (int i = 1; i <= v; i++) putchar(mini);
  res -= v;
  suffix_array();
  int c;
  for (int i = 0; i < n; i++) {
    if (sa[i] <= n / 2 && (n / 2 - sa[i]) <= res) {
      c = i;
      break;
    }
  }
  for (int i = 0; i < res; i++) putchar(s[sa[c] + i]);
  return 0;
}
