{"raw_statement":[{"iden":"problem statement","content":"Takahashi has a string $S$ of length $N$ consisting of lowercase English letters. On this string, he will perform the following operation $K$ times:\n\n*   Let $T$ be the string obtained by reversing $S$, and $U$ be the string obtained by concatenating $S$ and $T$ in this order.\n*   Let $S'$ be some contiguous substring of $U$ with length $N$, and replace $S$ with $S'$.\n\nAmong the strings that can be the string $S$ after the $K$ operations, find the lexicographically smallest possible one."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 5000$\n*   $1 \\leq K \\leq 10^9$\n*   $|S|=N$\n*   $S$ consists of lowercase English letters."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $K$\n$S$"},{"iden":"sample input 1","content":"5 1\nbacba"},{"iden":"sample output 1","content":"aabca\n\nWhen $S=$`bacba`, $T=$`abcab`, $U=$`bacbaabcab`, and the optimal choice of $S'$ is $S'=$`aabca`."},{"iden":"sample input 2","content":"10 2\nbbaabbbaab"},{"iden":"sample output 2","content":"aaaabbaabb"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}