#include <bits/stdc++.h>

int main() {
    using namespace std;

    unsigned long N, K;
    cin >> N >> K;
    string S;
    cin >> S;

    {
        string T(S.begin(), S.end());
        T += string(S.rbegin(), S.rend());
        for(unsigned long i = 0; i < N; ++i)S = min(S, string(T.begin() + i, T.begin() + i + N));
    }

    unsigned long k{static_cast<unsigned long>(find_if_not(S.begin(), S.end(), [&S](auto i){return i == S[0];}) - S.begin())};
    --K;

    if(K > 13 || (k << K) > N)cout << string(N, *min_element(S.begin(), S.end())) << endl;

    string A((k << K) - k, S[0]);
    A += string(S.begin(), S.begin() + N - A.size());

    cout << A << endl;

    return 0;
}