410093: GYM103940 J Joining the KAK
Description
The KAK (Klub Algorithmic Kukei) is a club from the Kukei university which has a peculiar story about how they got their name: One time they made advertisement and some merch that had their name printed, after everything was paid they noticed that they misspelled the word Club as Klub, they find it easier to keep the name rather than making all the advertisement and merch again.
Because of this experience now the KAK focuses a lot on grammar, that is why if you want to join the KAK they will ask something related to strings.
Today you want to join, and in your evaluation for joining the KAK they gave a lot of cards with letters in them, each card has exactly one letter. They ask you to find given a value a $$$k$$$ what would be the $$$k$$$-th string if you sorted lexicographically all the different strings that you can make arranging at least one of the cards and at most all of them? Two arrangements $$$A$$$ and $$$B$$$ are different if they have a different amount of cards or if at some position $$$x$$$ the letters of the cards at position $$$x$$$ differ.
Gain your entry to the "Klub" answering the question!
InputThe first line of input contains two integers $$$N$$$ and $$$K$$$ ($$$1 \leq N \leq 1000$$$, $$$1 \leq K \leq 10^6$$$) representing the number of cards that the KAK gave you and $$$k$$$. It is guaranteed that at least $$$k$$$ different strings can be made with the given cards.
The next line contains a string of size $$$N$$$ representing the $$$N$$$ pieces. All the letters are lowercase English letters.
OutputPrint a line containing a single word, the answer to the problem to join the KAK.
ExamplesInput3 2 aaaOutput
aaInput
3 15 abcOutput
cbaInput
10 120873 abcdefghijOutput
fgdhic