Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Lexicographical Smallest String

By nurshuvo51 · Limits 1s, 512 MB

There is a string $s$ of length $n$ containing lowercase letters and an integer $k$. Among the letters those appear exactly $k$ times in string $s$, pick the lexicographically maximum one. Now delete any (k-1) occurrences of this letter from the string in a way so that the resultant string is lexicographically smallest.

Note that if there is no letter which appears k times in s, no deletion takes place.

In this problem, you will have to determine what is the lexicographical smallest string after the deletions (possibly none)?

Input

The first line of the input contains $n$ ($1 ≤ n ≤ 100000$), the number of lowercase letters in string $s$ and $k$ ($0 ≤ k ≤ 10$).

The second line contains the string $s$.

Output

Print the lexicographically smallest string after the deletions (possibly none).

Sample

InputOutput
5 2
baabc

aabc


Statistics

60% Solution Ratio

tmwilliamlin168Earliest, Jan '20

AlfehsaniFastest, 0.0s

hoacruxLightest, 131 kB

bokaifShortest, 179B