#include <bits/stdc++.h>
using namespace std;
const int N = 100050;
const int M = 2 * N;
vector<pair<pair<int, int>, int> > tmp;
int id[M], per[M];
char s[M];
void BuildSuffixArray(int n) {
  int i, j;
  for (i = 1; i <= n; i++) id[i] = s[i] - 'a';
  for (j = 0; j < 20; j++) {
    tmp.clear();
    for (i = 1; i <= n; i++)
      tmp.push_back(make_pair(make_pair(id[i], id[i + (1 << j)]), i));
    sort(tmp.begin(), tmp.end());
    int cnt = 0;
    for (i = 0; i < tmp.size(); i++) {
      id[tmp[i].second] = cnt;
      cnt += ((i + 1 == tmp.size()) || (tmp[i].first != tmp[i + 1].first));
    }
    if (cnt == n) break;
  }
  for (i = 1; i <= n; i++) id[i]++;
  for (i = 1; i <= n; i++) per[id[i]] = i;
}
int main() {
  int n, k;
  scanf("%i %i", &n, &k);
  scanf("%s", s + 1);
  int t = n;
  for (int i = n; i >= 1; i--) s[++t] = s[i];
  s[++t] = 'a' + 27;
  BuildSuffixArray(t);
  int pos = per[1];
  for (int i = 1; i <= t; i++)
    if (t - per[i] >= n) {
      pos = per[i];
      break;
    }
  int sz = 0;
  while (sz < n && s[pos + sz] == s[pos]) sz++;
  long long mx = (long long)sz * (k - 1);
  if (mx >= n) {
    for (int i = 1; i <= n; i++) printf("%c", s[pos]);
    return 0;
  }
  for (int i = 1; i <= mx; i++) printf("%c", s[pos]);
  for (int i = 0; i < n - mx; i++) printf("%c", s[pos + i]);
  return 0;
}
