Password
Limits: 2 sec., 256 MiB
Zenyk wants to know the password to Marichka’s Facebook account.
There are \(n\) digits (1 to 9) lying on the floor. Zenyk knows that he should form \(k\) integers using those digits, in such a way the greatest integer is minimum possible — that would be the password. Of course, you have to use all \(n\) digits.
Please help Zenyk to find out the password.
Input
The first line contains two integers \(n\) and \(k\). The second line contains string of \(n\) digits 1 to 9.
Output
Print a single integer — the password.
Constraints
\(1 \le N \le 10^5\),
\(1 \le K \le N\).
Samples
Input (stdin) | Output (stdout) |
---|---|
7 4 4412377 | 34 |
Source: Обласна олімпіада 2017
Submit a solution
Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
---|
Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
---|