You are given an array of n integers and an integer k. Your task is to find the maximum and minimum possible median values among all possible subsequences of length k.
A subsequence is a sequence that can be derived from the array by deleting zero or more elements without changing the order of the remaining elements. The median of a subsequence is the middle element after it has been sorted.
1) For a subsequence of odd length k, the median is the element at position (k+1)/2 (1-based).
2) For a subsequence of even length k, the median is the element at position k/2 (the lower-middle element, 1-based).
Input Format:
The first line of input contains two space-separated integers, 'n' and 'k'.
The second line contains 'n' space-separated integers, representing the elements of the array.
Output Format:
Print a single line containing two space-separated integers: the maximum possible median followed by the minimum possible median.
Note:
The key insight is that the order of elements in the original array does not affect the values within a chosen subsequence, only their eligibility.