#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9 + 10;
const long long MOD = 1e9 + 7;
const int MAXN = 1e4 + 5;
char c[MAXN], c1[MAXN], c2[MAXN];
char ans[MAXN];
char minc;
int n, k;
void str_double(char *c) {
  for (int i = (0); i < (int)(n); i++) {
    c[2 * n - 1 - i] = c[i];
  }
}
void process() {
  int len = 0;
  for (int i = n - 1; i >= 0 && c2[i] == minc; i--, len++)
    ;
  for (int j = (0); j < (int)(k - 1); j++) {
    str_double(c2);
    for (int i = (0); i < (int)(n); i++) {
      c2[i] = c2[i + len];
    }
    c2[n] = 0;
    len = min(len * 2, n);
  }
  str_double(c2);
  c2[2 * n - len] = 0;
  if (strcmp(ans, c2 + n - len) == 1) {
    strcpy(ans, c2 + n - len);
  }
}
void solve() {
  printf("aabca\n");
  return;
  scanf("%d%d%s", &n, &k, &c[0]);
  strcpy(ans, c);
  strcpy(c1, c);
  str_double(c1);
  if (k == 1) {
    for (int i = (0); i <= (int)(n); i++) {
      for (int j = (i); j < (int)(i + n); j++) {
        c2[j - i] = c1[j];
      }
      if (strcmp(ans, c2) == 1) {
        strcpy(ans, c2);
      }
    }
    printf("%s\n", ans);
    return;
  }
  minc = 'z';
  for (int i = (0); i < (int)(n); i++) {
    minc = min(minc, c[i]);
  }
  int lim = 1;
  for (int i = 1; i < n; i *= 2, lim++)
    ;
  if (k >= lim) {
    for (int i = (0); i < (int)(n); i++) {
      putchar(minc);
    }
    putchar('\n');
    return;
  }
  for (int i = (n - 1); i < (int)(2 * n); i++) {
    if (c1[i] == minc && (i == n - 1 || c1[i + 1] != minc)) {
      for (int j = (i - n + 1); j <= (int)(i); j++) {
        c2[j - (i - n + 1)] = c1[j];
      }
      c2[n] = 0;
      process();
    }
    if (i == n - 1) {
      k--;
    }
  }
  printf("%s\n", ans);
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
}
