Lexicographically Smallest Rearrangement

Lexicographically Smallest Rearrangement

Time Limit: 2.0 s

Memory Limit: 512.0 MB

Description

You are given a string \(S\) consisting of lowercase English letters and an integer \(K\).
You may repeatedly choose a substring of length exactly \(K\) and rearrange all of its characters in any order. However, each index of the string can be used in at most one rearrangement operation.
Your task is to find the lexicographically smallest string that can be obtained.

A string a is lexicographically smaller than a string b if and only if one of the following holds:
a is a prefix of b, but a≠b;

in the first position where a and b differ, the string a has a letter that appears earlier in the alphabet than the corresponding letter in b.

Input

The first line contains two integers \(N\) and \(K (1 ≤ N ≤ 2*10^5,1 ≤ K ≤ N)\) — the length of the string and the parameter \(K\).
The second line contains the string s of length \(N\) , consisting only of lowercase English letters.

Output

Print the lexicographically smallest string obtainable.

Sample

Input Output
7 3
cbadabe
abcabde
6 2
bbcaac
bbacac
8 3
cbaabbaa
abcaabba

Information

ID
1230
Difficulty
7
Category
(None)
Tags
(None)
# Submissions
44
Accepted
7
Accepted Ratio
16%
Uploaded By