410093: GYM103940 J Joining the KAK

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

J. Joining the KAKtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

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!

Input

The 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.

Output

Print a line containing a single word, the answer to the problem to join the KAK.

ExamplesInput
3 2
aaa
Output
aa
Input
3 15
abc
Output
cba
Input
10 120873
abcdefghij
Output
fgdhic

加入题单

上一题 下一题 算法标签: