Lukas has decided to sell his movie production company, "Lukasfilm". N people have offered to buy the company. Instead of selling to the highest bidder, Lukas decides to sell his company to the Kth lowest bidder. How much money will Lukas get?
The first line of the input contains 2 space-separated integers, N and K. The next line contains N space separated integers A1, A2, ..., AN, denoting the money each of the N people are willing to pay.
Print a single integer, denoting the money Lukas will sell his company for.
- 1 ≤ K ≤ N ≤ 1000
- 1 ≤ Ai ≤ 10000
Input: 5 4 1 2 1 3 3 Output: 3
Out of the 5 bids, the 4th lowest amount is 3.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYP3|
Fetching successful submissions
If you are still having problems, see a sample solution here.