import java.util.*;
public class Main2 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
List<Integer> nums = new ArrayList<>();
while (in.hasNextInt()) {
nums.add(in.nextInt());
}
Integer Kth = nums.get(nums.size() - 1);
nums.remove(nums.size() - 1);
Integer result = obtainKthNum(nums, Kth);
System.out.print(result);
}
private static Boolean checkBasic(Integer Kth, List<Integer> nums) {
if (nums == null || nums.size() <= 0
|| Kth <= 0 || Kth > nums.size()) {
return false;
}
return true;
}
private static Integer obtainKthNum(List<Integer> nums, Integer Kth) {
if (!checkBasic(Kth, nums)) {
return Integer.MAX_VALUE;
}
Queue<Integer> largestK = new PriorityQueue<>();
for (Integer num : nums) {
largestK.add(num);
if (largestK.size() > Kth)
largestK.poll();
}
return largestK.poll();
}
}