#include <bits/stdc++.h>
using namespace std;
const int N = 10050;
const int M = 2 * N;
char s[N];
struct SuffixArray {
  char s[M];
  int tot;
  pair<pair<int, int>, int> tmp[M];
  int id[M * 2], sa[M], lcp[M];
  void AddChar(char c) { s[++tot] = c; }
  void Build() {
    s[++tot] = 'a' + 27;
    for (int i = 1; i <= tot; i++) id[i] = s[i];
    for (int j = 1;; j <<= 1) {
      for (int i = 1; i <= tot; i++) tmp[i] = {{id[i], id[i + j]}, i};
      sort(tmp + 1, tmp + 1 + tot);
      int c = 0;
      for (int i = 1; i <= tot; i++) {
        id[tmp[i].second] = c + 1;
        c += tmp[i].first != tmp[i + 1].first;
      }
      if (c == tot) break;
    }
    for (int i = 1; i <= tot; i++) sa[id[i]] = i;
  }
  void Kasai() {
    for (int i = 1, k = 0; i <= tot; i++)
      if (id[i] != tot) {
        int j = sa[id[i] + 1];
        while (s[i + k] == s[j + k]) k++;
        lcp[id[i]] = k;
        if (k) k--;
      }
  }
} SA;
int main() {
  int n, k;
  scanf("%i %i", &n, &k);
  scanf("%s", s + 1);
  int t = n;
  for (int i = 1; i <= n; i++) SA.AddChar(s[i]);
  for (int i = n; i >= 1; i--) SA.AddChar(s[i]), s[++t] = s[i];
  SA.Build();
  int pos = SA.sa[1];
  int sz = 0;
  while (s[pos + sz] == s[pos]) sz++;
  long long mx = (long long)sz * k;
  if (mx >= n) {
    for (int i = 1; i <= n; i++) printf("%c", s[pos]);
    return 0;
  }
  int use = sz * (k - 1);
  for (int i = 1; i <= use; i++) printf("%c", s[pos]);
  for (int i = 0; i < n - use; i++) printf("%c", s[pos + i]);
  return 0;
}
