eolymp
bolt
Try our new interface for solving problems
Problems

Big Number

Big Number

Trillion, quadrillion, quintillion, sextillion, septillion, octillion ? all is trifle! Vasya knows how to get a really big number. One should consider several ?ordinary? numbers, and then write them down consequently one after another on a piece of paper. Vasya decided to demonstrate this idea to his elder brother Pete. He prepared a sequence of N positive integers and started writing them down one after another on a piece of paper. After observing this process for a while, Pete got tired and suggested Vasya to solve the following puzzle. Vasya?s goal is to remove exactly K numbers from his sequence so that if one concatenates the remaining numbers (keeping the original order) he gets the largest possible number. Please, help Vasya. \InputFile The first line contains two integers \textbf{N} and \textbf{K} denoting how many numbers are prepared by Vasya and how many of them should be removed, respectively (\textbf{2} ≤ \textbf{N} ≤ \textbf{10^5}, \textbf{1} ≤ \textbf{K} ≤ \textbf{N} − \textbf{1} and \textbf{K} ≤ \textbf{100}). The second line contains \textbf{N} space separated positive integers not exceeding \textbf{10^9}. \OutputFile Please, output the largest possible number Vasya can obtain by removing exactly K numbers from the sequence.
Time limit 3 seconds
Memory limit 256 MiB
Input example #1
5 2
123 37 45 9 18
Output example #1
1234518
Source ACM ICPC 2010-2011 NEERC Moscow Subregional