#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  int K;
  string S;
  cin >> N;
  cin >> K;
  cin >> S;
  if (K >= N) {
    int mini;
    for (int i = 0; i < S.size(); i++) {
      if (S.at(i) < S.at(mini)) {
        mini = i;
      }
    }
    string result = string(N, S.at(mini));
    cout << result << endl;
    return 0;
  }
  string T = S;
  reverse(T.begin(), T.end());
  string base = S + T;
  string min_S = base.substr(0, N);
  for (int i = 0; i < N; i++) {
    string cut_S = base.substr(i, N);
    reverse(cut_S.begin(), cut_S.end());
    if (cut_S < min_S) {
      min_S = cut_S;
    }
  }
  char head = min_S.at(0);
  int times = 1;
  while (true) {
    if (head != min_S.at(times)) {
      break;
    }
    times++;
  }
  string result;
  if (K * times > N) {
    string result = string(N, min_S.at(0));
    cout << result << endl;
    return 0;
  }
  K--;
  string add = min_S.substr(0, N - K * times);
  result = string(K * times, min_S.at(0)) + add;
  cout << result << endl;
  return 0;
}
